mirror of
https://github.com/nmap/nmap.git
synced 2026-07-11 02:34:55 +00:00
Defensive checks for null or corrupt structures
This commit is contained in:
parent
b7e3657ec7
commit
1641d13cf9
1 changed files with 3 additions and 2 deletions
|
|
@ -125,20 +125,21 @@ bool TargetGroup::load_expressions(HostGroupState *hs, int af) {
|
|||
rit != requests.end(); rit++) {
|
||||
const DNS::Request &req = *rit;
|
||||
NetBlock *nb_old = (NetBlock *) req.userdata;
|
||||
assert(nb_old != NULL);
|
||||
NetBlock *nb_new = nb_old->resolve(req);
|
||||
nb_it = std::find(nb_it, netblocks.end(), nb_old);
|
||||
assert(nb_it != netblocks.end());
|
||||
|
||||
if (nb_new == NULL) {
|
||||
// Resolution failed; remove the NetBlock
|
||||
nb_it = netblocks.erase(nb_it);
|
||||
delete nb_old;
|
||||
}
|
||||
else {
|
||||
assert (nb_new != nb_old);
|
||||
// Resolution succeeded; replace the NetBlock
|
||||
*nb_it = nb_new;
|
||||
delete nb_old;
|
||||
}
|
||||
delete nb_old;
|
||||
}
|
||||
requests.clear();
|
||||
return !netblocks.empty();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue