1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 22:21:29 +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

@@ -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);
while (i--) {
sockaddr_storage *ss = &o.decoys[o.numdecoys];
memset(ss, 0, sizeof(sockaddr_storage));
ss->ss_family = AF_INET;
do {
((struct sockaddr_in *)&o.decoys[o.numdecoys])->sin_addr.s_addr = get_random_u32();
} while (ip_is_reserved(&o.decoys[o.numdecoys]));
((struct sockaddr_in *)ss)->sin_addr.s_addr = get_random_u32();
} while (ip_is_reserved(ss));
o.numdecoys++;
}
} else {