summaryrefslogtreecommitdiffstats
path: root/src/lib/hooks/callout_manager.cc
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2018-03-31 18:48:38 +0200
committerTomek Mrugalski <tomasz@isc.org>2018-05-16 15:48:57 +0200
commit98781a7ade130685cf0b6938189f207f66996ab4 (patch)
tree3a0698ebe59cd1c56496bbe5f7a6055b22811a47 /src/lib/hooks/callout_manager.cc
parent[5577] Fixed out of bound bug (diff)
downloadkea-98781a7ade130685cf0b6938189f207f66996ab4.tar.xz
kea-98781a7ade130685cf0b6938189f207f66996ab4.zip
[5577] Another case of out-of-bound access
Diffstat (limited to '')
-rw-r--r--src/lib/hooks/callout_manager.cc10
1 files changed, 10 insertions, 0 deletions
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<CalloutPtr>(0));