Commit 553a0556 authored by Michael Büsch's avatar Michael Büsch

ssb_sprom: Fix segfault in parameter parsing code.

Signed-off-by: Michael Büsch's avatarMichael Buesch <mb@bu3sch.de>
parent 91cb76df
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment