summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2015-01-22 14:51:56 -0700
committerMohamad Ayyash <mkayyash@google.com>2015-03-06 17:58:15 -0800
commiteaa89f5256b92e78067dc3649e4d9b7a70149302 (patch)
tree5fcef045418649834ee3ae4f96e57e4076b45aac
parent20ffe02885b5519da7b1cb2355f0e14efa382efc (diff)
downloadfio-eaa89f5256b92e78067dc3649e4d9b7a70149302.tar.gz
parse: ensure strings are pre-terminated when using strncpy()
Signed-off-by: Jens Axboe <axboe@fb.com>
-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: */