Module: sems Branch: master Commit: 21d344c1ebac31bacb5080bbee85149383bdd855 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=21d344c1ebac31bacb5080bbee85149383bdd855
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Thu Aug 11 17:01:12 2011 +0200 b/f: further safety precautions on timer buckets --- apps/db_reg_agent/RegistrationTimer.cpp | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/apps/db_reg_agent/RegistrationTimer.cpp b/apps/db_reg_agent/RegistrationTimer.cpp index 997c015..ff74031 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<RegTimer*>::iterator it = buckets[bucket_index].timers.begin(); while (it != buckets[bucket_index].timers.end() && (timer->expires > (*it)->expires)) _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
