1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Avoid undefined behavior from calling front() on possibly empty std::list

This commit is contained in:
dmiller
2016-06-17 16:11:33 +00:00
parent 60a1c85a93
commit b012b84a8e

View File

@@ -2264,7 +2264,7 @@ static int launchSomeServiceProbes(nsock_pool nsp, ServiceGroup *SG) {
// Check that the service is still where we left it. // Check that the service is still where we left it.
// servicescan_connect_handler can call end_svcprobe before this point, // servicescan_connect_handler can call end_svcprobe before this point,
// putting it into services_finished already. // putting it into services_finished already.
if (SG->services_remaining.front() == svc) { if (!SG->services_remaining.empty() && SG->services_remaining.front() == svc) {
// Now remove it from the remaining service list // Now remove it from the remaining service list
SG->services_remaining.pop_front(); SG->services_remaining.pop_front();
// And add it to the in progress list // And add it to the in progress list