[Asterisk-code-review] config.c: Fix a crash in extconfig parsing (...asterisk[16])

Joshua Colp asteriskteam at digium.com
Wed Apr 10 06:41:03 CDT 2019


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

Change subject: config.c: Fix a crash in extconfig parsing
......................................................................

config.c: Fix a crash in extconfig parsing

When extconfig.conf file is parsed, the code previously searched for
character comma without verifying if error (null or blank).  This caused
a segmentation error.

Change-Id: Id76b452d8f330d11c2742c37232761ad71472a8b
---
M main/config.c
1 file changed, 4 insertions(+), 1 deletion(-)

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



diff --git a/main/config.c b/main/config.c
index f694c2b..5660fbe 100644
--- a/main/config.c
+++ b/main/config.c
@@ -2904,7 +2904,10 @@
 		ast_copy_string(buf, v->value, sizeof(buf));
 		stringp = buf;
 		driver = strsep(&stringp, ",");
-
+		if (!stringp) {
+			ast_log(LOG_WARNING, "extconfig.conf: value '%s' ignored due to wrong format\n", v->value);
+			continue;
+		}
 		if ((tmp = strchr(stringp, '\"')))
 			stringp = tmp;
 

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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Id76b452d8f330d11c2742c37232761ad71472a8b
Gerrit-Change-Number: 11230
Gerrit-PatchSet: 4
Gerrit-Owner: Christian Savinovich <csavinovich at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190410/e58715dd/attachment.html>


More information about the asterisk-code-review mailing list