file: fix potential buffer overrun in get_fs_free_counts()
authorJens Axboe <axboe@fb.com>
Mon, 14 Apr 2014 14:45:13 +0000 (08:45 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 14 Apr 2014 14:45:13 +0000 (08:45 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
filesetup.c

index bf56112b72b9784cf32583ebc0dbba72324b9f86..c132c326e33afe5766cb2fbe15e1d031b8a30fa3 100644 (file)
@@ -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)