1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-25 17:09:02 +00:00

Fix bugs in protocol file parsing

Protocol numbers were being used as a short in network byte order
instead of host byte order, so this command would fail:
nmap -sO -p tcp

Additionally, duplicate protocols would not be reported correctly. This
change speeds up lookups and simplifies the code.
This commit is contained in:
dmiller
2022-09-15 16:05:53 +00:00
parent 5f21094a68
commit 30c045621c
2 changed files with 49 additions and 53 deletions

View File

@@ -75,18 +75,11 @@
#include "libnetutil/netutil.h"
#endif
#define PROTOCOL_TABLE_SIZE 256
struct nprotoent {
const char *p_name;
short p_proto;
};
struct protocol_list {
struct nprotoent *protoent;
struct protocol_list *next;
};
int addprotocolsfromservmask(char *mask, u8 *porttbl);
struct nprotoent *nmap_getprotbynum(int num);