summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2013-06-14 21:57:31 +0000
committerJoshua Colp <jcolp@digium.com>2013-06-14 21:57:31 +0000
commit671d7e62c799240989b00ebdd6b60a1dc37d019d (patch)
treea1bf4c1f27ba11a5ee051a4838827fc6e49a19e8 /res
parentb5a10ad9728078826a466c9765b2da6883dbd115 (diff)
Ensure that the number of added contacts never goes below 0.
This can happen when a REGISTER request is removing a contact. (closes issue ASTERISK-21911) Reported by: mdavenport git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391902 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_sip_registrar.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/res/res_sip_registrar.c b/res/res_sip_registrar.c
index 0cc5821ee..c3315d0be 100644
--- a/res/res_sip_registrar.c
+++ b/res/res_sip_registrar.c
@@ -259,7 +259,7 @@ static pj_bool_t registrar_on_rx_request(struct pjsip_rx_data *rdata)
return PJ_TRUE;
}
- if (((added - deleted) + (!aor->remove_existing ? ao2_container_count(contacts) : 0)) > aor->max_contacts) {
+ if ((MAX(added - deleted, 0) + (!aor->remove_existing ? ao2_container_count(contacts) : 0)) > aor->max_contacts) {
/* Enforce the maximum number of contacts */
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 403, NULL, NULL, NULL);
return PJ_TRUE;