From 5b16ed8d32e302c37a5d8f4dcfb8ab16bf9e8196 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Tue, 31 Dec 2019 08:28:35 +1000 Subject: [PATCH] dinitcheck: fix nullptr deref if service can't be loaded --- src/dinitcheck.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dinitcheck.cc b/src/dinitcheck.cc index c23f264..0f0402a 100644 --- a/src/dinitcheck.cc +++ b/src/dinitcheck.cc @@ -144,6 +144,7 @@ int main(int argc, char **argv) for (size_t i = 0; i < num_services_to_check; ++i) { service_record *root = service_set[services_to_check[i]]; + if (! root) continue; if (root->visited) continue; // invariant: service_chain is empty @@ -332,7 +333,7 @@ service_record *load_service(service_set_t &services, const std::string &name, catch (std::system_error &sys_err) { report_error(sys_err, name); - return nullptr; + throw service_description_exc(name, "Error while reading service description."); } if (settings.service_type != service_type_t::INTERNAL && settings.command.length() == 0) { -- 2.25.1