mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
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
This commit is contained in:
@@ -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));
|
||||
|
Reference in New Issue
Block a user