mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 16:57:06 +00:00
Avoid integer overflow in multiplication. See #1834
This commit is contained in:
parent
d5b57a8cd9
commit
b74f70fb33
1 changed files with 9 additions and 1 deletions
|
|
@ -3118,7 +3118,15 @@ int NpingOps::echoPayload(bool value){
|
|||
int NpingOps::getTotalProbes(){
|
||||
int total_ports=0;
|
||||
this->getTargetPorts(&total_ports);
|
||||
return this->getPacketCount() * total_ports * this->targets.Targets.size();
|
||||
u64 tmp = (u64) this->getPacketCount() * total_ports;
|
||||
if (tmp > INT_MAX) {
|
||||
return -1;
|
||||
}
|
||||
tmp *= this->targets.Targets.size();
|
||||
if (tmp > INT_MAX) {
|
||||
return -1;
|
||||
}
|
||||
return (int) tmp;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue