]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5577] Another case of out-of-bound access
authorFrancis Dupont <fdupont@isc.org>
Sat, 31 Mar 2018 16:48:38 +0000 (18:48 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Wed, 16 May 2018 13:48:57 +0000 (15:48 +0200)
src/lib/hooks/callout_manager.cc

index 55d4a5fd66c4f618dda1071253e1cb268d803b99..9e93439465a5ebd4449a18c14c7ed5f6bbff566d 100644 (file)
@@ -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<CalloutPtr>(0));