[Asterisk-code-review] chan pjsip: Creating Channel Causes Asterisk to Crash When D... (asterisk[master])

Matt Jordan asteriskteam at digium.com
Wed Apr 29 10:13:03 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: chan_pjsip: Creating Channel Causes Asterisk to Crash When Duplicate AOR             Sections Exist in pjsip.conf
......................................................................


chan_pjsip: Creating Channel Causes Asterisk to Crash When Duplicate AOR
            Sections Exist in pjsip.conf

This patch modifies the current loading strategy of the pjsip configuration. If
duplicate sections (e.g. sections containing the same [id/type]) are defined in
[pjsip.conf], the loader will consider the configuration for the given type as
invalid when the duplicate section is encountered. The entire configuration
(including what was previously loaded) for the duplicate [id/type] sections
will be rejected and destroyed, an error message is logged and the load
processing for the given stops.

ASTERISK-24996
Reported By: Ashley Sanders

Change-Id: I35090ca4cd40f1f34881dfe701a329145c347aef
---
M res/res_sorcery_config.c
1 file changed, 12 insertions(+), 0 deletions(-)

Approvals:
  Matt Jordan: Looks good to me, approved; Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_sorcery_config.c b/res/res_sorcery_config.c
index 60ecb83..deb2ffa 100644
--- a/res/res_sorcery_config.c
+++ b/res/res_sorcery_config.c
@@ -294,6 +294,18 @@
 			continue;
 		}
 
+		/*  Confirm an object with this id does not already exist in the bucket.
+		 *  If it exists, however, the configuration is invalid so stop
+		 *  processing and destroy it. */
+		obj = ao2_find(objects, id, OBJ_KEY;
+
+		if (obj) {
+			ast_log(LOG_ERROR, "Config file '%s' could not be loaded; configuration contains a duplicate object: '%s' of type '%s'\n",
+				config->filename, id, type);
+			ast_config_destroy(cfg);
+			return;
+		}
+
 		if (!(obj = ast_sorcery_alloc(sorcery, type, id)) ||
 		    ast_sorcery_objectset_apply(sorcery, obj, ast_category_first(category))) {
 

-- 
To view, visit https://gerrit.asterisk.org/254
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I35090ca4cd40f1f34881dfe701a329145c347aef
Gerrit-PatchSet: 4
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list