From c3588d9c0b5cc1df5f5dd4d52d06be2b5f48fabf Mon Sep 17 00:00:00 2001
From: Sean Bright <sean.bright@gmail.com>
Date: Mon, 13 Jul 2020 16:42:40 -0400
Subject: [PATCH] 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
---
 main/acl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main/acl.c b/main/acl.c
index a560046574..2a40fae51a 100644
--- a/main/acl.c
+++ b/main/acl.c
@@ -578,7 +578,7 @@ static struct ast_ha *append_ha_core(const char *sense, const char *stuff, struc
 	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;
-- 
GitLab