2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +00:00

Merge branch '2403-dig-has-a-fit-with-option-multi-typo-on-multi' into 'main'

Report unknown dash option during the pre-parse phase

Closes #2403

See merge request isc-projects/bind9!4590
This commit is contained in:
Ondřej Surý
2021-01-26 13:17:02 +00:00
2 changed files with 13 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
5567. [bug] Dig now reports unknown dash options while pre-parsing
the options. This prevents '-multi' instead of
'+multi' reporting memory usage before ending option
parsing on 'Invalid option: -lti'. [GL #2403]
5566. [func] Add "stale-answer-client-timeout" option, which 5566. [func] Add "stale-answer-client-timeout" option, which
is the amount of time a recursive resolver waits before is the amount of time a recursive resolver waits before
attempting to answer the query using stale data from cache. attempting to answer the query using stale data from cache.

View File

@@ -2341,16 +2341,20 @@ preparse_args(int argc, char **argv) {
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) { goto invalid_option;
/* Error or value in option. */ }
if (strlen(option) > 1U) {
/* 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. */
rc--, rv++; rc--, rv++;
/* Handle missing argument */ /* Handle missing argument */
if (rc == 0) { if (rc == 0) {
break; invalid_option:
fprintf(stderr, "Invalid option: -%s\n", option);
usage();
} }
} }
} }