From b012b84a8ef441fb53e1c7447caa1055a4164b1c Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 17 Jun 2016 16:11:33 +0000 Subject: [PATCH] Avoid undefined behavior from calling front() on possibly empty std::list --- service_scan.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_scan.cc b/service_scan.cc index c42431498..e61d65383 100644 --- a/service_scan.cc +++ b/service_scan.cc @@ -2264,7 +2264,7 @@ static int launchSomeServiceProbes(nsock_pool nsp, ServiceGroup *SG) { // Check that the service is still where we left it. // servicescan_connect_handler can call end_svcprobe before this point, // 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 SG->services_remaining.pop_front(); // And add it to the in progress list