[Asterisk-code-review] res_ael: Fix pattern matching against literal '+' (...asterisk[13])
Sean Bright
asteriskteam at digium.com
Thu Apr 11 11:12:17 CDT 2019
Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11260
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-18362 #close
Reported by: Dennis
Change-Id: I8d2cccb3479168fba1b0a6704c52198b396468f1
---
M res/ael/pval.c
1 file changed, 5 insertions(+), 10 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/60/11260/1
diff --git a/res/ael/pval.c b/res/ael/pval.c
index bbfeb2d..bcac63a 100644
--- a/res/ael/pval.c
+++ b/res/ael/pval.c
@@ -760,10 +760,10 @@
*r++ = '.';
*r++ = '*';
break;
- case '*':
+ case '*': /* regex metacharacter */
+ case '+': /* regex metacharacter */
*r++ = '\\';
- *r++ = '*';
- break;
+ /* fall through */
default:
*r++ = *p;
break;
@@ -793,14 +793,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/+/11260
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I8d2cccb3479168fba1b0a6704c52198b396468f1
Gerrit-Change-Number: 11260
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190411/5c3a85c6/attachment.html>
More information about the asterisk-code-review
mailing list