[asterisk-commits] main/config options: Check for existance of internal object ... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 21 08:08:36 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: main/config_options: Check for existance of internal object before derefing
......................................................................


main/config_options: Check for existance of internal object before derefing

Asterisk can load and register an object type while still having an invalid
sorcery mapping. This can cause an issue when a creation call is invoked.
For example, mis-configuring PJSIP's endpoint identifier by IP address mapping
in sorcery.conf will cause the sorcery mechanism to be invalidated; however, a
subsequent ARI invocation to create the object will cause a crash, as the
internal type may not be registered as sorcery expects.

Merely checking for a NULL pointer here solves the issue.

Change-Id: I54079fb94a1440992f4735a9a1bbf1abb1c601ac
---
M main/config_options.c
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/main/config_options.c b/main/config_options.c
index a1ba5d2..4ab7a5b 100644
--- a/main/config_options.c
+++ b/main/config_options.c
@@ -837,6 +837,10 @@
 	struct aco_option *opt;
 	struct ao2_iterator iter;
 
+	if (!type->internal) {
+		return -1;
+	}
+
 	iter = ao2_iterator_init(type->internal->opts, 0);
 
 	while ((opt = ao2_iterator_next(&iter))) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I54079fb94a1440992f4735a9a1bbf1abb1c601ac
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list