mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Handle 'unknown' service name in -p. Fixes #2658
This commit is contained in:
@@ -285,6 +285,8 @@ int addportsfromservmask(const char *mask, u8 *porttbl, int range_type) {
|
|||||||
|
|
||||||
for (i = service_table.begin(); i != service_table.end(); i++) {
|
for (i = service_table.begin(); i != service_table.end(); i++) {
|
||||||
const service_node& current = i->second;
|
const service_node& current = i->second;
|
||||||
|
if (!current.s_name)
|
||||||
|
continue;
|
||||||
if (wildtest(mask, current.s_name)) {
|
if (wildtest(mask, current.s_name)) {
|
||||||
if ((range_type & SCAN_TCP_PORT) && strcmp(current.s_proto, "tcp") == 0) {
|
if ((range_type & SCAN_TCP_PORT) && strcmp(current.s_proto, "tcp") == 0) {
|
||||||
porttbl[current.s_port] |= SCAN_TCP_PORT;
|
porttbl[current.s_port] |= SCAN_TCP_PORT;
|
||||||
|
|||||||
2
utils.cc
2
utils.cc
@@ -81,6 +81,8 @@ extern NmapOps o;
|
|||||||
int wildtest(const char *wild, const char *test) {
|
int wildtest(const char *wild, const char *test) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
assert(wild);
|
||||||
|
assert(test);
|
||||||
while (*wild != '\0' || *test != '\0') {
|
while (*wild != '\0' || *test != '\0') {
|
||||||
if (*wild == '*') {
|
if (*wild == '*') {
|
||||||
/* --- Deal with multiple asterisks. --- */
|
/* --- Deal with multiple asterisks. --- */
|
||||||
|
|||||||
Reference in New Issue
Block a user