projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add check for OPT_LEN_MAX being too small
[fio.git]
/
parse.c
diff --git
a/parse.c
b/parse.c
index a55e52b02e513bc0c02603e4c1eb801f435029a9..d44d13082c91dd8951cbe0be7edf2c51dd73d7e0 100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-620,6
+620,11
@@
static char *option_dup_subs(const char *opt)
ssize_t nchr = OPT_LEN_MAX;
size_t envlen;
ssize_t nchr = OPT_LEN_MAX;
size_t envlen;
+ if (strlen(in) + 1 > OPT_LEN_MAX) {
+ fprintf(stderr, "OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
+ return NULL;
+ }
+
in[OPT_LEN_MAX] = '\0';
strncpy(in, opt, OPT_LEN_MAX);
in[OPT_LEN_MAX] = '\0';
strncpy(in, opt, OPT_LEN_MAX);
@@
-659,6
+664,8
@@
int parse_option(const char *opt, struct fio_option *options, void *data)
char *post, *tmp;
tmp = option_dup_subs(opt);
char *post, *tmp;
tmp = option_dup_subs(opt);
+ if (!tmp)
+ return 1;
o = get_option(tmp, options, &post);
if (!o) {
o = get_option(tmp, options, &post);
if (!o) {