From 98781a7ade130685cf0b6938189f207f66996ab4 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Sat, 31 Mar 2018 18:48:38 +0200 Subject: [PATCH] [5577] Another case of out-of-bound access --- src/lib/hooks/callout_manager.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) 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)); -- 2.47.2