[svn-commits] file: trunk r391902 - /trunk/res/res_sip_registrar.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 14 16:57:32 CDT 2013


Author: file
Date: Fri Jun 14 16:57:31 2013
New Revision: 391902

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391902
Log:
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

Modified:
    trunk/res/res_sip_registrar.c

Modified: trunk/res/res_sip_registrar.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_sip_registrar.c?view=diff&rev=391902&r1=391901&r2=391902
==============================================================================
--- trunk/res/res_sip_registrar.c (original)
+++ trunk/res/res_sip_registrar.c Fri Jun 14 16:57:31 2013
@@ -259,7 +259,7 @@
 		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;




More information about the svn-commits mailing list