Fix potentially unterminated string after strncpy() call
[fio.git] / diskutil.c
index 5170915c91d5309eeae539b2cc32e9531c7c16d4..1b4accb31d5c669b6ae09638b60c1d4a840ddad6 100644 (file)
@@ -297,7 +297,7 @@ static struct disk_util *disk_util_add(struct thread_data *td, int majdev,
                sfree(du);
                return NULL;
        }
                sfree(du);
                return NULL;
        }
-       strncpy((char *) du->dus.name, basename(path), FIO_DU_NAME_SZ);
+       strncpy((char *) du->dus.name, basename(path) - 1, FIO_DU_NAME_SZ);
        du->sysfs_root = path;
        du->major = majdev;
        du->minor = mindev;
        du->sysfs_root = path;
        du->major = majdev;
        du->minor = mindev;