diff options
author | Jens Axboe <axboe@fb.com> | 2015-01-22 14:51:56 -0700 |
---|---|---|
committer | Mohamad Ayyash <mkayyash@google.com> | 2015-03-06 17:58:15 -0800 |
commit | eaa89f5256b92e78067dc3649e4d9b7a70149302 (patch) | |
tree | 5fcef045418649834ee3ae4f96e57e4076b45aac | |
parent | 20ffe02885b5519da7b1cb2355f0e14efa382efc (diff) | |
download | fio-eaa89f5256b92e78067dc3649e4d9b7a70149302.tar.gz |
parse: ensure strings are pre-terminated when using strncpy()
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | parse.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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: */ |