Summary:ASTERISK-01895: [patch] character class in : operator regexp terminates expression
Reporter:Frank Mandarino (fmandarino)Labels:
Date Opened:2004-06-25 13:55:04Date Closed:2008-01-15 15:00:36.000-0600
Versions:Frequency of
Environment:Attachments:( 0) expr_end_patch.txt
Description:In pbx_substitute_variables_helper(), the code to extract an expression bounded by $[ ... ] stops early if a ':' operator is used and the regular-expression contains a character class.

For example, if the expression "$[${VAR} : [123]]" is used and ${VAR} is '3', the first ']' terminates the loop which searches for the end of the expression, and the expression "3 : [123" is passed to ast_expr() which results in an invalid regular expression error.

The attached patch simply includes '[' in the bracket count when searching for the expression end.

Note that the search will still fail if the regexp tries to match literal '[' or ']' characters, unless they happened to be balanced.
Comments:By: Mark Spencer (markster) 2004-06-25 14:37:53

I don't think the escaped brackets is going to be a big deal.  I've added your patch into CVS.  Thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:00:36.000-0600

Repository: asterisk
Revision: 3304

U   trunk/pbx.c

r3304 | markster | 2008-01-15 15:00:35 -0600 (Tue, 15 Jan 2008) | 2 lines

Cleanup handling of complex expressions (bug ASTERISK-1895)