diff options
author | Scott Griepentrog <scott@griepentrog.com> | 2015-08-17 11:00:53 -0500 |
---|---|---|
committer | Scott Griepentrog <scott@griepentrog.com> | 2015-08-17 11:03:06 -0500 |
commit | 178e1adffbcfe02d70e9def261e8c95f6e3bc8fe (patch) | |
tree | 49694db5549e2ad47e9eaa9d04d90e40d813e27e /main | |
parent | 5a85711568fa4268465c0f6f8a3b49ff8b09bcf1 (diff) |
CHAOS: prevent sorcery object with null id
When allocating a sorcery object, fail if the
id value was not allocated.
ASTERISK-25323
Reported by: Scott Griepentrog
Change-Id: I152133fb7545a4efcf7a0080ada77332d038669e
Diffstat (limited to 'main')
-rw-r--r-- | main/sorcery.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/main/sorcery.c b/main/sorcery.c index 6d24b1486..f9f7c3873 100644 --- a/main/sorcery.c +++ b/main/sorcery.c @@ -1739,6 +1739,10 @@ void *ast_sorcery_alloc(const struct ast_sorcery *sorcery, const char *type, con } else { details->object->id = ast_strdup(id); } + if (!details->object->id) { + ao2_ref(details, -1); + return NULL; + } details->object->created = ast_tvnow(); ast_copy_string(details->object->type, type, sizeof(details->object->type)); |