From: Francis Dupont Date: Sat, 31 Mar 2018 16:48:38 +0000 (+0200) Subject: [5577] Another case of out-of-bound access X-Git-Tag: trac5549a_base~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98781a7ade130685cf0b6938189f207f66996ab4;p=thirdparty%2Fkea.git [5577] Another case of out-of-bound access --- diff --git a/src/lib/hooks/callout_manager.cc b/src/lib/hooks/callout_manager.cc index 55d4a5fd66..9e93439465 100644 --- a/src/lib/hooks/callout_manager.cc +++ b/src/lib/hooks/callout_manager.cc @@ -242,6 +242,11 @@ CalloutManager::deregisterCallout(const std::string& name, CalloutPtr callout) { // process). int hook_index = server_hooks_.getIndex(name); + // New hooks can have been registered since the manager was constructed. + if (hook_index >= hook_vector_.size()) { + return (false); + } + /// Construct a CalloutEntry matching the current library and the callout /// we want to remove. CalloutEntry target(current_library_, callout); @@ -285,6 +290,11 @@ CalloutManager::deregisterAllCallouts(const std::string& name) { // process). int hook_index = server_hooks_.getIndex(name); + // New hooks can have been registered since the manager was constructed. + if (hook_index >= hook_vector_.size()) { + return (false); + } + /// Construct a CalloutEntry matching the current library (the callout /// pointer is NULL as we are not checking that). CalloutEntry target(current_library_, static_cast(0));