From: Jens Axboe Date: Fri, 11 Apr 2014 17:32:49 +0000 (-0600) Subject: Fix potentially unterminated string after strncpy() call X-Git-Tag: fio-2.1.9~71 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=18ef0638590c8baf153d93ab7a6da7f85d07b6ef Fix potentially unterminated string after strncpy() call Signed-off-by: Jens Axboe --- diff --git a/diskutil.c b/diskutil.c index 5170915c..1b4accb3 100644 --- a/diskutil.c +++ b/diskutil.c @@ -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;