mirror of
https://github.com/asterisk/asterisk.git
synced 2026-07-02 21:13:08 -07:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user