1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 20:51:30 +00:00

Set ss_family when generating random decoys. Fixes #2757.

This commit is contained in:
dmiller
2025-06-17 21:50:10 +00:00
parent 75f3f97763
commit a600528532
2 changed files with 8 additions and 2 deletions

View File

@@ -1,5 +1,8 @@
#Nmap Changelog ($Id$); -*-text-*- #Nmap Changelog ($Id$); -*-text-*-
o [GH#2757] Fix a crash in traceroute when using randomly-generated decoys:
"Assertion `source->ss_family == AF_INET' failed" [Daniel Miller]
o [GH#2899] When IP protocol scanning on IPv6 (-sO -6), skip protocol numbers o [GH#2899] When IP protocol scanning on IPv6 (-sO -6), skip protocol numbers
that are registered as Extension Header values. When the --data option was that are registered as Extension Header values. When the --data option was
used, these would fail the assertion "len == (u32) ntohs(ip6->ip6_plen)" used, these would fail the assertion "len == (u32) ntohs(ip6->ip6_plen)"

View File

@@ -1780,9 +1780,12 @@ void apply_delayed_options() {
fatal("You are only allowed %d decoys (if you need more redefine MAX_DECOYS in nmap.h)", MAX_DECOYS); fatal("You are only allowed %d decoys (if you need more redefine MAX_DECOYS in nmap.h)", MAX_DECOYS);
while (i--) { while (i--) {
sockaddr_storage *ss = &o.decoys[o.numdecoys];
memset(ss, 0, sizeof(sockaddr_storage));
ss->ss_family = AF_INET;
do { do {
((struct sockaddr_in *)&o.decoys[o.numdecoys])->sin_addr.s_addr = get_random_u32(); ((struct sockaddr_in *)ss)->sin_addr.s_addr = get_random_u32();
} while (ip_is_reserved(&o.decoys[o.numdecoys])); } while (ip_is_reserved(ss));
o.numdecoys++; o.numdecoys++;
} }
} else { } else {