parse: fix segfault if posval option doesn't have a value
authorJens Axboe <axboe@fb.com>
Wed, 16 Dec 2015 15:32:30 +0000 (08:32 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 16 Dec 2015 15:32:30 +0000 (08:32 -0700)
If the user did

continue_on_error

in the job file without setting one of the possible values
for that option, we'd crash in string compare. Now fio will
exit in error, showing the valid options instead.

Signed-off-by: Jens Axboe <axboe@fb.com>
parse.c

diff --git a/parse.c b/parse.c
index df42e227477e14f5082da58741a3a107e5d341f5..0ef00b81cda60ffb6209a0c3b305b370aeee8810 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -483,6 +483,8 @@ 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 (!ptr)
+                               break;
                        if (!strncmp(vp->ival, ptr, str_match_len(vp, ptr))) {
                                ret = 0;
                                if (o->off1)