summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2014-02-07 20:17:50 +0000
committerMatthew Jordan <mjordan@digium.com>2014-02-07 20:17:50 +0000
commit8b295a2792e0c51175a477368d5ae00c02b84256 (patch)
treeadef93c73d6b50904a31825d0ffca084424ed404
parente8e2f91bbac77ca50dddc4a496512475990a8764 (diff)
security_events: Fix assertion failure in dev-mode on optional IE parsing
When formatting an optional IE, the value is, of course, optional. As such, it is entirely appropriate for ast_json_object_get to return NULL. If that occurs, we now simply skip the IE that was requested, as it was not provided by the entity that raised the event. Thanks to George Joseph (gtjoseph) for catching this and reporting it in #asterisk-dev ........ Merged revisions 407750 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407752 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--main/security_events.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main/security_events.c b/main/security_events.c
index bf35b1c7c..bd8ed5dba 100644
--- a/main/security_events.c
+++ b/main/security_events.c
@@ -391,7 +391,9 @@ static int append_event_str_single(struct ast_str **str, struct ast_json *json,
const char *ie_type_key = ast_event_get_ie_type_name(ie_type);
struct ast_json *json_string = ast_json_object_get(json, ie_type_key);
- ast_assert(json_string != NULL);
+ if (!json_string) {
+ return 0;
+ }
if (ast_str_append(str, 0, "%s: %s\r\n", ie_type_key, S_OR(ast_json_string_get(json_string), "")) == -1) {
return -1;