mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
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
This commit is contained in:
@@ -759,10 +759,10 @@ static int extension_matches(pval *here, const char *exten, const char *pattern)
|
||||
*r++ = '.';
|
||||
*r++ = '*';
|
||||
break;
|
||||
case '*':
|
||||
case '*': /* regex metacharacter */
|
||||
case '+': /* regex metacharacter */
|
||||
*r++ = '\\';
|
||||
*r++ = '*';
|
||||
break;
|
||||
/* fall through */
|
||||
default:
|
||||
*r++ = *p;
|
||||
break;
|
||||
@@ -792,14 +792,9 @@ static int extension_matches(pval *here, const char *exten, const char *pattern)
|
||||
exten, pattern); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if ( strcmp(exten,pattern) == 0 ) {
|
||||
return 1;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user