projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
64666f8
)
parse: ensure strings are pre-terminated when using strncpy()
author
Jens Axboe
<axboe@fb.com>
Thu, 22 Jan 2015 21:51:56 +0000
(14:51 -0700)
committer
Jens Axboe
<axboe@fb.com>
Thu, 22 Jan 2015 21:51:56 +0000
(14:51 -0700)
Signed-off-by: Jens Axboe <axboe@fb.com>
parse.c
patch
|
blob
|
blame
|
history
diff --git
a/parse.c
b/parse.c
index e70ed20bda7e64b3727e93cacad71de65148862b..7912212ecda47594bac999e8abbecdacaf81aeb1 100644
(file)
--- 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: */