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

Ashley Sanders asteriskteam at digium.com
Fri Apr 24 10:42:38 CDT 2015


Ashley Sanders has uploaded a new change for review.

  https://gerrit.asterisk.org/254

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 to consider the entire
pjsip configuration as invalid if duplicate sections (e.g. sections containing
the same [id/type]) are defined in pjsip.conf. If a duplicate section
is encountered during load, the entire configuration is rejected and destroyed,
an error message is logged and the load processing stops.

ASTERISK-24996 #close
Reported By: Ashley Sanders

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


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/54/254/1

diff --git a/res/res_sorcery_config.c b/res/res_sorcery_config.c
index 60ecb83..9635aae 100644
--- a/res/res_sorcery_config.c
+++ b/res/res_sorcery_config.c
@@ -294,6 +294,14 @@
 			continue;
 		}
 
+		/* Confirm an object with this id does not already exist in the bucket. If so, the configuration is invalid so, destroy it and stop processing. */
+		if ((obj = ao2_find(objects, id, OBJ_KEY))) {
+			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: newchange
Gerrit-Change-Id: I35090ca4cd40f1f34881dfe701a329145c347aef
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Ashley Sanders <asanders at digium.com>



More information about the asterisk-code-review mailing list