From: Davin McCall Date: Mon, 30 Dec 2019 22:28:35 +0000 (+1000) Subject: dinitcheck: fix nullptr deref if service can't be loaded X-Git-Tag: v0.8.1~7 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5b16ed8d32e302c37a5d8f4dcfb8ab16bf9e8196;p=oweals%2Fdinit.git dinitcheck: fix nullptr deref if service can't be loaded --- 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) {