[Asterisk-code-review] acl.c: Coerce a NULL pointer into the empty string (asterisk[master])

George Joseph asteriskteam at digium.com
Mon Jul 20 11:38:10 CDT 2020


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14661 )

Change subject: acl.c: Coerce a NULL pointer into the empty string
......................................................................

acl.c: Coerce a NULL pointer into the empty string

If an ACL is misconfigured in the realtime database (for instance, the
"rule" is blank) and Asterisk attempts to read the ACL, Asterisk will
crash.

ASTERISK-28978 #close

Change-Id: Ic1536c4df856231bfd2da00128f7822224d77610
---
M main/acl.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/main/acl.c b/main/acl.c
index a560046..2a40fae 100644
--- a/main/acl.c
+++ b/main/acl.c
@@ -578,7 +578,7 @@
 	struct ast_ha *ha;
 	struct ast_ha *prev = NULL;
 	struct ast_ha *ret;
-	char *tmp, *list = ast_strdupa(stuff);
+	char *tmp, *list = ast_strdupa(stuff ?: "");
 	char *address = NULL, *mask = NULL;
 	int addr_is_v4;
 	int allowing = strncasecmp(sense, "p", 1) ? AST_SENSE_DENY : AST_SENSE_ALLOW;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14661
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ic1536c4df856231bfd2da00128f7822224d77610
Gerrit-Change-Number: 14661
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200720/5c179a80/attachment.html>


More information about the asterisk-code-review mailing list