Fix potentially unterminated string after strncpy() call
authorJens Axboe <axboe@fb.com>
Fri, 11 Apr 2014 17:32:49 +0000 (11:32 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 11 Apr 2014 17:32:49 +0000 (11:32 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
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;
        }
-       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;