masscan icon indicating copy to clipboard operation
masscan copied to clipboard

A possible divide by zero bug

Open yiyuaner opened this issue 3 years ago • 0 comments

In function massip_pick in file massip.c, we have the following code:` https://github.com/robertdavidgraham/masscan/blob/1310495455ec3156f0194e0f7f9dad3a281419c5/src/massip.c#L34

The variable massip->count_ipv4s is used as a divisor. However it may be zero. Consider the following call sequence: main -> main_listscan -> massip_pick

The check in the main function is not sufficient to prevent the above call sequence with a zero count_ipv4s value: https://github.com/robertdavidgraham/masscan/blob/1310495455ec3156f0194e0f7f9dad3a281419c5/src/main.c#L1665

yiyuaner avatar Aug 17 '21 02:08 yiyuaner