From: Jens Axboe Date: Wed, 14 Jul 2010 22:27:02 +0000 (-0600) Subject: Really fix broken option length check X-Git-Tag: fio-1.42~2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=808def7036ddfaf6f0ec2f5ecce031fd46ce40ef Really fix broken option length check Commit 7b4cb1320928bdea2360cf36fc45c83700052d43 matched the string passed in, but that doesn't work for postfix values appended. Signed-off-by: Jens Axboe --- diff --git a/parse.c b/parse.c index e03592d8..d8061610 100644 --- a/parse.c +++ b/parse.c @@ -278,6 +278,17 @@ static int check_int(const char *p, int *val) return 1; } +static int opt_len(const char *str) +{ + char *postfix; + + postfix = strchr(str, ':'); + if (!postfix) + return strlen(str); + + return (int)(postfix - str); +} + #define val_store(ptr, val, off, or, data) \ do { \ ptr = td_var((data), (off)); \ @@ -320,7 +331,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, if (!vp->ival || vp->ival[0] == '\0') continue; all_skipped = 0; - if (!strncmp(vp->ival, ptr, strlen(ptr))) { + if (!strncmp(vp->ival, ptr, opt_len(ptr))) { ret = 0; if (o->roff1) { if (vp->or)