[Asterisk-code-review] res_ael: Fix pattern matching against literal '+' (...asterisk[16])
Joshua Colp
asteriskteam at digium.com
Tue Apr 16 07:25:49 CDT 2019
Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11261 )
Change subject: res_ael: Fix pattern matching against literal '+'
......................................................................
res_ael: Fix pattern matching against literal '+'
When generating the regular expression that matches against existing
extensions, we need to escape literal characters that can also be
regular expression metacharacters. This was already being done for '*'
but we need to do the same for '+'.
In passing, remove some unreachable code - strcmp() is already run
immediately when entering extension_matches().
ASTERISK-14939 #close
Reported by: klaus3000
Change-Id: I8d2cccb3479168fba1b0a6704c52198b396468f1
---
M res/ael/pval.c
1 file changed, 5 insertions(+), 10 deletions(-)
Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/res/ael/pval.c b/res/ael/pval.c
index f927077..37d53ad 100644
--- a/res/ael/pval.c
+++ b/res/ael/pval.c
@@ -759,10 +759,10 @@
*r++ = '.';
*r++ = '*';
break;
- case '*':
+ case '*': /* regex metacharacter */
+ case '+': /* regex metacharacter */
*r++ = '\\';
- *r++ = '*';
- break;
+ /* fall through */
default:
*r++ = *p;
break;
@@ -792,14 +792,9 @@
exten, pattern); */
return 1;
}
-
-
- } else {
- if ( strcmp(exten,pattern) == 0 ) {
- return 1;
- } else
- return 0;
}
+
+ return 0;
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11261
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I8d2cccb3479168fba1b0a6704c52198b396468f1
Gerrit-Change-Number: 11261
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.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/20190416/6c9339e8/attachment.html>
More information about the asterisk-code-review
mailing list