[Asterisk-code-review] CHAOS: prevent sorcery object with null id (asterisk[master])

Mark Michelson asteriskteam at digium.com
Mon Aug 17 15:41:21 CDT 2015


Mark Michelson has submitted this change and it was merged.

Change subject: CHAOS: prevent sorcery object with null id
......................................................................


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
---
M main/sorcery.c
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified



diff --git a/main/sorcery.c b/main/sorcery.c
index 6d24b14..f9f7c38 100644
--- a/main/sorcery.c
+++ b/main/sorcery.c
@@ -1739,6 +1739,10 @@
 	} 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));

-- 
To view, visit https://gerrit.asterisk.org/1100
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I152133fb7545a4efcf7a0080ada77332d038669e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list