parse: ensure strings are pre-terminated when using strncpy()
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/parse.c b/parse.c
index e70ed20..7912212 100644
--- a/parse.c
+++ b/parse.c
@@ -506,6 +506,7 @@
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 @@
char tmp[128];
char *p1, *p2;
+ tmp[sizeof(tmp) - 1] = '\0';
strncpy(tmp, ptr, sizeof(tmp) - 1);
/* Handle bsrange with separate read,write values: */