From da27a4bf0f9753fcc9da7b63f1be482fc0349907 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 14 Apr 2014 08:45:13 -0600 Subject: [PATCH] file: fix potential buffer overrun in get_fs_free_counts() Signed-off-by: Jens Axboe --- filesetup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.25.1