diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-02-02 18:59:29 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-02-02 18:59:29 +0000 |
commit | 5a3a71e21d74d2cd23738a5d2c9c07171f530dbc (patch) | |
tree | 342efb9d445e1ffb6c48dadd3f796f7ae0cfa1fc /funcs | |
parent | 4ca71daefe23ec85a29acf0e2f0786d2f7f9a7ad (diff) |
Merged revisions 244331 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r244331 | tilghman | 2010-02-02 12:54:33 -0600 (Tue, 02 Feb 2010) | 9 lines
Correct some off-by-one errors, especially when expressions don't contain expected spaces.
Also include the tests provided by the reporter, as regression tests.
(closes issue #16667)
Reported by: wdoekes
Patches:
astsvn-func_match-off-by-one.diff uploaded by wdoekes (license 717)
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@244333 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r-- | funcs/func_math.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/funcs/func_math.c b/funcs/func_math.c index a9217d8f3..3039051aa 100644 --- a/funcs/func_math.c +++ b/funcs/func_math.c @@ -114,47 +114,47 @@ static int math(struct ast_channel *chan, const char *cmd, char *parse, *op = '\0'; } else if ((op = strstr(mvalue1, "AND"))) { iaction = BITWISEANDFUNCTION; - op += 3; *op = '\0'; + op += 2; } else if ((op = strstr(mvalue1, "XOR"))) { iaction = BITWISEXORFUNCTION; - op += 3; *op = '\0'; + op += 2; } else if ((op = strstr(mvalue1, "OR"))) { iaction = BITWISEORFUNCTION; - op += 2; *op = '\0'; + ++op; } else if ((op = strchr(mvalue1, '>'))) { iaction = GTFUNCTION; *op = '\0'; if (*(op + 1) == '=') { - *++op = '\0'; iaction = GTEFUNCTION; + ++op; } else if (*(op + 1) == '>') { - *++op = '\0'; iaction = SHRIGHTFUNCTION; + ++op; } } else if ((op = strchr(mvalue1, '<'))) { iaction = LTFUNCTION; *op = '\0'; if (*(op + 1) == '=') { - *++op = '\0'; iaction = LTEFUNCTION; + ++op; } else if (*(op + 1) == '<') { - *++op = '\0'; iaction = SHLEFTFUNCTION; + ++op; } } else if ((op = strchr(mvalue1, '='))) { *op = '\0'; if (*(op + 1) == '=') { - *++op = '\0'; iaction = EQFUNCTION; + ++op; } else op = NULL; } else if ((op = strchr(mvalue1, '+'))) { iaction = ADDFUNCTION; *op = '\0'; - } else if ((op = strchr(mvalue1, '-'))) { /* subtraction MUST always be last, in case we have a negative first number */ + } else if ((op = strchr(mvalue1, '-'))) { /* subtraction MUST always be last, in case we have a negative second number */ iaction = SUBTRACTFUNCTION; *op = '\0'; } |