2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00
This commit is contained in:
Evan Hunt
2018-11-13 16:41:54 -08:00
parent 77128c867c
commit e356d93175

View File

@@ -1370,8 +1370,10 @@ preparse_args(int argc, char **argv) {
char *option; char *option;
for (argc--, argv++; argc > 0; argc--, argv++) { for (argc--, argv++; argc > 0; argc--, argv++) {
if (argv[0][0] != '-') if (argv[0][0] != '-') {
continue; continue;
}
option = &argv[0][1]; option = &argv[0][1];
while (strpbrk(option, single_dash_opts) == &option[0]) { while (strpbrk(option, single_dash_opts) == &option[0]) {
switch (option[0]) { switch (option[0]) {
@@ -1394,22 +1396,29 @@ preparse_args(int argc, char **argv) {
} }
option = &option[1]; option = &option[1];
} }
if (strlen(option) == 0U) { if (strlen(option) == 0U) {
continue; continue;
} }
/* Look for dash value option. */ /* Look for dash value option. */
if (strpbrk(option, dash_opts) != &option[0] || if (strpbrk(option, dash_opts) != &option[0] ||
strlen(option) > 1U) { strlen(option) > 1U)
{
/* Error or value in option. */ /* Error or value in option. */
continue; continue;
} }
/* Dash value is next argument so we need to skip it. */ /* Dash value is next argument so we need to skip it. */
argc--, argv++; argc--;
argv++;
/* Handle missing argument */ /* Handle missing argument */
if (argc == 0) if (argc == 0) {
break; break;
} }
} }
}
/* /*
* Argument parsing is based on dig, but simplified: only one * Argument parsing is based on dig, but simplified: only one