From: Mark Andrews Date: Thu, 21 Jan 2021 22:58:06 +0000 (+1100) Subject: Report unknown dash option during the pre-parse phase X-Git-Tag: v9.17.10~22^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3361c0d6f862ba60957a3eb6bc46658572f126ae;p=thirdparty%2Fbind9.git Report unknown dash option during the pre-parse phase --- diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 711dedf4309..76c491f073b 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -2341,16 +2341,20 @@ preparse_args(int argc, char **argv) { continue; } /* Look for dash value option. */ - if (strpbrk(option, dash_opts) != &option[0] || - strlen(option) > 1U) { - /* Error or value in option. */ + if (strpbrk(option, dash_opts) != &option[0]) { + goto invalid_option; + } + if (strlen(option) > 1U) { + /* value in option. */ continue; } /* Dash value is next argument so we need to skip it. */ rc--, rv++; /* Handle missing argument */ if (rc == 0) { - break; + invalid_option: + fprintf(stderr, "Invalid option: -%s\n", option); + usage(); } } }