summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2015-01-22 14:51:56 -0700
committerJens Axboe <axboe@fb.com>2015-01-22 14:51:56 -0700
commit209e10374bb57565f0a61286d1ed8effd50fa95c (patch)
tree9454369e2f864d0b75449bfcf7bb834d814272c7 /parse.c
parent64666f8fe2242cbe4d804df2305924a9e43e8699 (diff)
downloadfio-209e10374bb57565f0a61286d1ed8effd50fa95c.tar.gz
fio-209e10374bb57565f0a61286d1ed8effd50fa95c.tar.bz2
parse: ensure strings are pre-terminated when using strncpy()
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index e70ed20b..7912212e 100644
--- a/parse.c
+++ b/parse.c
@@ -506,6 +506,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
if (!is_time && o->is_time)
is_time = o->is_time;
+ tmp[sizeof(tmp) - 1] = '\0';
strncpy(tmp, ptr, sizeof(tmp) - 1);
p = strchr(tmp, ',');
if (p)
@@ -705,6 +706,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
char tmp[128];
char *p1, *p2;
+ tmp[sizeof(tmp) - 1] = '\0';
strncpy(tmp, ptr, sizeof(tmp) - 1);
/* Handle bsrange with separate read,write values: */