From: Matt Jordan Date: Fri, 4 Sep 2015 02:15:13 +0000 (-0500) Subject: main/config_options: Check for existance of internal object before derefing X-Git-Tag: 13.6.0-rc1~27^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fchanges%2F92%2F1192%2F3;p=thirdparty%2Fasterisk.git 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 --- diff --git a/main/config_options.c b/main/config_options.c index 0cc2dda3e5..0c706ac53f 100644 --- a/main/config_options.c +++ b/main/config_options.c @@ -837,6 +837,10 @@ int aco_set_defaults(struct aco_type *type, const char *category, void *obj) 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))) {