diff options
author | Matt Jordan <mjordan@digium.com> | 2015-09-03 21:15:13 -0500 |
---|---|---|
committer | Matt Jordan <mjordan@digium.com> | 2015-09-11 16:21:07 -0500 |
commit | 45cf79665c73b7e52391d0f30724e71a630f6698 (patch) | |
tree | 93730f02cc12f054f0e0fc0d9121453d82c5df09 /main/config_options.c | |
parent | 6097a1fc058600764c6714f6650c2dc71b46cc21 (diff) |
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
Diffstat (limited to 'main/config_options.c')
-rw-r--r-- | main/config_options.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/main/config_options.c b/main/config_options.c index a1ba5d2e5..4ab7a5b9a 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))) { |