diff --git a/apps/db_reg_agent/RegistrationTimer.cpp b/apps/db_reg_agent/RegistrationTimer.cpp index 997c0155..ff740319 100644 --- a/apps/db_reg_agent/RegistrationTimer.cpp +++ b/apps/db_reg_agent/RegistrationTimer.cpp @@ -58,6 +58,17 @@ int RegistrationTimer::get_bucket_index(time_t tv) { } void RegistrationTimer::place_timer(RegTimer* timer, int bucket_index) { + if (bucket_index < 0) { + ERROR("trying to place_timer with negative index (%i)\n", bucket_index); + return; + } + + if (bucket_index > TIMER_BUCKETS) { + ERROR("trying to place_timer with too high index (%i vs %i)\n", + bucket_index, TIMER_BUCKETS); + return; + } + std::list::iterator it = buckets[bucket_index].timers.begin(); while (it != buckets[bucket_index].timers.end() && (timer->expires > (*it)->expires))