From: Jens Axboe Date: Mon, 14 Apr 2014 14:45:13 +0000 (-0600) Subject: file: fix potential buffer overrun in get_fs_free_counts() X-Git-Tag: fio-2.1.9~59 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=da27a4bf0f9753fcc9da7b63f1be482fc0349907;ds=sidebyside file: fix potential buffer overrun in get_fs_free_counts() Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index bf56112b..c132c326 100644 --- a/filesetup.c +++ b/filesetup.c @@ -688,7 +688,8 @@ static unsigned long long get_fs_free_counts(struct thread_data *td) } else if (f->filetype != FIO_TYPE_FILE) continue; - strcpy(buf, f->file_name); + buf[255] = '\0'; + strncpy(buf, f->file_name, 255); if (stat(buf, &sb) < 0) { if (errno != ENOENT)