[Asterisk-code-review] core: Fix segfault when invoking 'data get' CLI command (asterisk[14])

Joshua Colp asteriskteam at digium.com
Wed Jul 5 18:46:37 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5959 )

Change subject: core: Fix segfault when invoking 'data get' CLI command
......................................................................

core: Fix segfault when invoking 'data get' CLI command

Invoking 'data get /asterisk/core/channeltypes' caused a crash because
of an assumption of a tech's capabilities to be non-NULL. The
'Surrogate' tech, however, does have a NULL capabilities member,
resulting in a crash.

ASTERISK-27108 #close

Change-Id: I2fbe7715681f43d5565d1e1599269468c26b0e0a
---
M main/data.c
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/main/data.c b/main/data.c
index 1aaae18..a65d0b8 100644
--- a/main/data.c
+++ b/main/data.c
@@ -3145,6 +3145,10 @@
 		return -1;
 	}
 
+	if (!cap) {
+		return 0;
+	}
+
 	count = ast_format_cap_count(cap);
 	for (i = 0; i < count; ++i) {
 		struct ast_format *fmt;

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

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: merged
Gerrit-Change-Id: I2fbe7715681f43d5565d1e1599269468c26b0e0a
Gerrit-Change-Number: 5959
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170705/6f516cf3/attachment.html>


More information about the asterisk-code-review mailing list