]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
CHAOS: prevent sorcery object with null id 01/1101/1
authorScott Griepentrog <scott@griepentrog.com>
Mon, 17 Aug 2015 16:00:53 +0000 (11:00 -0500)
committerScott Griepentrog <sgriepentrog@digium.com>
Mon, 17 Aug 2015 16:05:26 +0000 (11:05 -0500)
When allocating a sorcery object, fail if the
id value was not allocated.

ASTERISK-25323
Reported by: Scott Griepentrog

Change-Id: I152133fb7545a4efcf7a0080ada77332d038669e

main/sorcery.c

index 2f451961b955135da800fd9b511891f590619e7d..43a395ad0c946e6e847e03cd28a2b08df10e44af 100644 (file)
@@ -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));