diff --git a/bin/delv/delv.c b/bin/delv/delv.c index ba654f4777..7b7e63ae0d 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -1370,8 +1370,10 @@ preparse_args(int argc, char **argv) { char *option; for (argc--, argv++; argc > 0; argc--, argv++) { - if (argv[0][0] != '-') + if (argv[0][0] != '-') { continue; + } + option = &argv[0][1]; while (strpbrk(option, single_dash_opts) == &option[0]) { switch (option[0]) { @@ -1394,20 +1396,27 @@ preparse_args(int argc, char **argv) { } option = &option[1]; } + if (strlen(option) == 0U) { continue; } + /* Look for dash value option. */ if (strpbrk(option, dash_opts) != &option[0] || - strlen(option) > 1U) { + strlen(option) > 1U) + { /* Error or value in option. */ continue; } + /* Dash value is next argument so we need to skip it. */ - argc--, argv++; + argc--; + argv++; + /* Handle missing argument */ - if (argc == 0) + if (argc == 0) { break; + } } }