From aedf17917885adb9e44a42b4b37e9e9c98af9939 Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 9 May 2023 14:16:46 +0000 Subject: [PATCH] Catch unsupported -P options for those that don't take a port argument --- nmap.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nmap.cc b/nmap.cc index db2d4f6fd..d38821ad8 100644 --- a/nmap.cc +++ b/nmap.cc @@ -1131,6 +1131,9 @@ void parse_options(int argc, char **argv) { else { char buf[4] = "P\0"; buf[1] = *optarg; + if (*(optarg + 1) != '\0' && NULL == strchr("STAUYBO", *optarg)) { + fatal("Unknown -P option -P%s.", optarg); + } switch (*optarg) { case 'I': delayed_options.warn_deprecated(buf, "PE");