From: Alan T. DeKok Date: Sun, 4 Jan 2015 21:05:37 +0000 (-0500) Subject: Allow unary negation before parantheses X-Git-Tag: release_3_0_7~360 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc312127003fdbd5a412516e1989c30b1c7ca998;p=thirdparty%2Ffreeradius-server.git Allow unary negation before parantheses --- diff --git a/src/modules/rlm_expr/rlm_expr.c b/src/modules/rlm_expr/rlm_expr.c index ee60e16ffc9..5a15a6a8822 100644 --- a/src/modules/rlm_expr/rlm_expr.c +++ b/src/modules/rlm_expr/rlm_expr.c @@ -213,6 +213,11 @@ static bool get_number(REQUEST *request, char const **string, int64_t *answer) goto done; } + if (*p == '-') { + negative = true; + p++; + } + /* * Look for an attribute. */ @@ -285,11 +290,6 @@ static bool get_number(REQUEST *request, char const **string, int64_t *answer) goto done; } - if (*p == '-') { - negative = true; - p++; - } - if ((*p < '0') || (*p > '9')) { RDEBUG2("Not a number at \"%s\"", p); return false; @@ -306,11 +306,11 @@ static bool get_number(REQUEST *request, char const **string, int64_t *answer) p++; } - if (negative) x = -x; - +done: if (invert) x = ~x; -done: + if (negative) x = -x; + *string = p; *answer = x; return true;