From: Scott Griepentrog Date: Mon, 17 Aug 2015 16:00:53 +0000 (-0500) Subject: CHAOS: prevent sorcery object with null id X-Git-Tag: 13.6.0-rc1~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab373f2ceffcad3a497663027199f4f4a81f644b;p=thirdparty%2Fasterisk.git 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 --- diff --git a/main/sorcery.c b/main/sorcery.c index 2f451961b9..43a395ad0c 100644 --- a/main/sorcery.c +++ b/main/sorcery.c @@ -1736,6 +1736,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; + } ast_copy_string(details->object->type, type, sizeof(details->object->type));