X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=parse.c;h=d44d13082c91dd8951cbe0be7edf2c51dd73d7e0;hp=a55e52b02e513bc0c02603e4c1eb801f435029a9;hb=38789b58775ee5e00f4669f01b3c9da31a7345e3;hpb=c06c78c04c415bcb33350e8e56b924b75b4e93aa diff --git a/parse.c b/parse.c index a55e52b0..d44d1308 100644 --- 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; + 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); @@ -659,6 +664,8 @@ int parse_option(const char *opt, struct fio_option *options, void *data) char *post, *tmp; tmp = option_dup_subs(opt); + if (!tmp) + return 1; o = get_option(tmp, options, &post); if (!o) {