From: Jens Axboe Date: Mon, 14 Apr 2014 19:25:12 +0000 (-0600) Subject: disk util: fix bug in strncpy() conversion X-Git-Tag: fio-2.1.9~24 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=a2ba41edb1d278237a5990c4860291b35463f231;p=fio.git disk util: fix bug in strncpy() conversion Signed-off-by: Jens Axboe --- diff --git a/diskutil.c b/diskutil.c index 3ee5c6c8..cb285cff 100644 --- a/diskutil.c +++ b/diskutil.c @@ -300,7 +300,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) - 1, FIO_DU_NAME_SZ); + strncpy((char *) du->dus.name, basename(path), FIO_DU_NAME_SZ - 1); du->sysfs_root = path; du->major = majdev; du->minor = mindev;