b/f: further safety precautions on timer buckets

sayer/1.4-spce2.6
Stefan Sayer 15 years ago committed by Stefan Sayer
parent a94de00b66
commit 015c2e3f3c

@ -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<RegTimer*>::iterator it = buckets[bucket_index].timers.begin();
while (it != buckets[bucket_index].timers.end() &&
(timer->expires > (*it)->expires))

Loading…
Cancel
Save