[Asterisk-code-review] pbx.c: Properly parse labels with leading digits (...asterisk[master])

George Joseph asteriskteam at digium.com
Fri Apr 12 14:16:10 CDT 2019


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11266 )

Change subject: pbx.c: Properly parse labels with leading digits
......................................................................

pbx.c: Properly parse labels with leading digits

If the target of a Goto is a label that starts with a number, we
erroneously treat the leading digits as a priority.

ASTERISK-20182 #close
Reported by: Janu

Change-Id: Ia78408c0805a729103917247ecfc802f6fafc94b
---
M main/pbx.c
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/main/pbx.c b/main/pbx.c
index ee5ed7e..4a83453 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -8760,6 +8760,7 @@
 	char *stringp;
 	int ipri;
 	int mode = 0;
+	char rest[2] = "";
 
 	if (ast_strlen_zero(goto_string)) {
 		ast_log(LOG_WARNING, "Goto requires an argument ([[context,]extension,]priority)\n");
@@ -8785,7 +8786,7 @@
 		mode = -1;
 		pri++;
 	}
-	if (sscanf(pri, "%30d", &ipri) != 1) {
+	if (sscanf(pri, "%30d%1s", &ipri, rest) != 1) {
 		ipri = ast_findlabel_extension(chan, context ? context : ast_channel_context(chan),
 			exten ? exten : ast_channel_exten(chan), pri,
 			S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL));

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ia78408c0805a729103917247ecfc802f6fafc94b
Gerrit-Change-Number: 11266
Gerrit-PatchSet: 1
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 digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190412/60c1d723/attachment.html>


More information about the asterisk-code-review mailing list