From: Tilghman Lesher Date: Wed, 10 Feb 2010 15:36:57 +0000 (+0000) Subject: Enable warnings on atypical conditions for the FILTER function (suggested by mmichels... X-Git-Tag: 11.0.0-beta1~3454 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eaea15aa02adff800988d37c8d8d1048175882f4;p=thirdparty%2Fasterisk.git Enable warnings on atypical conditions for the FILTER function (suggested by mmichelson on the -dev list). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246022 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/funcs/func_strings.c b/funcs/func_strings.c index 34bff1e554..faf0ce2b26 100644 --- a/funcs/func_strings.c +++ b/funcs/func_strings.c @@ -603,6 +603,10 @@ static int filter(struct ast_channel *chan, const char *cmd, char *parse, char * return -1; } + if (args.allowed[0] == '"' && !ast_opt_dont_warn) { + ast_log(LOG_WARNING, "FILTER allowed characters includes the quote (\") character. This may not be what you want.\n"); + } + /* Expand ranges */ for (; *(args.allowed) && allowedlen < sizeof(allowed); ) { char c1 = 0, c2 = 0; @@ -617,6 +621,10 @@ static int filter(struct ast_channel *chan, const char *cmd, char *parse, char * c2 = -1; args.allowed += consumed + 1; + if ((c2 < c1 || c2 == -1) && !ast_opt_dont_warn) { + ast_log(LOG_WARNING, "Range wrapping in FILTER(%s,%s). This may not be what you want.\n", parse, args.string); + } + /*!\note * Looks a little strange, until you realize that we can overflow * the size of a char.