From: Michael Buesch Date: Mon, 16 Jun 2008 16:30:12 +0000 (+0200) Subject: ssb_sprom: Fix segfault in parameter parsing code. X-Git-Tag: b43-fwcutter-013~40 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=553a0556695787e4c3b3bffb7ebb8d03b9578c88;p=b43-tools.git ssb_sprom: Fix segfault in parameter parsing code. Signed-off-by: Michael Buesch --- diff --git a/ssb_sprom/ssb_sprom.c b/ssb_sprom/ssb_sprom.c index facacab..a9080a2 100644 --- a/ssb_sprom/ssb_sprom.c +++ b/ssb_sprom/ssb_sprom.c @@ -1016,12 +1016,12 @@ static int do_cmp_arg(char **argv, int *pos, } if (strcmp(arg, template) == 0) { if (param) { - /* Skip the parameter on the next iteration. */ - (*pos)++; if (*param == 0) { prerror("%s needs a parameter\n", arg); return ARG_ERROR; } + /* Skip the parameter on the next iteration. */ + (*pos)++; } return ARG_MATCH; } @@ -1511,7 +1511,8 @@ static int parse_args(int argc, char *argv[]) if (err) goto error; } else { - prerror("Unrecognized argument: %s\n", argv[i]); + if (!parse_err) + prerror("Unrecognized argument: %s\n", argv[i]); goto out_usage; } if (parse_err)