From 2da490f8471e035732df1a3b9a8a29bcb7a97b47 Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 16 Jun 2023 18:20:16 +0000 Subject: [PATCH] Fix segfault when using service name wildcards with -p. --- protocols.cc | 4 ++-- protocols.h | 2 +- services.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protocols.cc b/protocols.cc index f06b2293a..8b22351da 100644 --- a/protocols.cc +++ b/protocols.cc @@ -132,14 +132,14 @@ static int nmap_protocols_init() { /* Now we make sure our protocols don't have duplicates */ if (!status.second) { if (o.debugging > 1) { - error("Protocol %d (%s) has duplicate number (%d) in protocols file %s", status.first->second.p_proto, ent.p_name, protno, filename); + error("Protocol %hu (%s) has duplicate number (%hu) in protocols file %s", status.first->second.p_proto, ent.p_name, protno, filename); } continue; } if (protocol_table[protno]) { if (o.debugging > 1) { - error("Protocol %d (%s) has duplicate name (%s) in protocols file %s", protno, protocol_table[protno]->p_name, ent.p_name, filename); + error("Protocol %hu (%s) has duplicate name (%s) in protocols file %s", protno, protocol_table[protno]->p_name, ent.p_name, filename); } continue; } diff --git a/protocols.h b/protocols.h index 9f2253f1e..01bdf4857 100644 --- a/protocols.h +++ b/protocols.h @@ -71,7 +71,7 @@ struct nprotoent { const char *p_name; - short p_proto; + u16 p_proto; }; int addprotocolsfromservmask(char *mask, u8 *porttbl); diff --git a/services.h b/services.h index 6f88980ac..a256e738c 100644 --- a/services.h +++ b/services.h @@ -69,7 +69,7 @@ struct nservent { const char *s_name; const char *s_proto; - short s_port; + u16 s_port; }; int addportsfromservmask(const char *mask, u8 *porttbl, int range_type);