--- parser3/src/classes/math.C 2023/11/16 23:54:54 1.103 +++ parser3/src/classes/math.C 2024/09/28 14:37:53 1.106 @@ -23,7 +23,7 @@ extern "C" char *crypt(const char* , const char* ); #endif -volatile const char * IDENT_MATH_C="$Id: math.C,v 1.103 2023/11/16 23:54:54 moko Exp $"; +volatile const char * IDENT_MATH_C="$Id: math.C,v 1.106 2024/09/28 14:37:53 moko Exp $"; // defines @@ -109,6 +109,7 @@ static void math2(Request& r, MethodPara } MATH2(pow) +MATH2(atan2) inline bool is_salt_body_char(unsigned char c) { return pa_isalnum(c) || c == '.' || c=='/'; @@ -317,7 +318,7 @@ void SHA1PadMessage(SHA1Context *context void SHA1ReadDigest(void *buf, SHA1Context *c) { if(!SHA1Result(c)) - throw Exception (PARSER_RUNTIME, 0, "Can not compute SHA1"); + throw Exception (PARSER_RUNTIME, 0, "Cannot compute SHA1"); ((uint32_t *)buf)[0] = SWAP(c->Message_Digest[0]); ((uint32_t *)buf)[1] = SWAP(c->Message_Digest[1]); @@ -633,7 +634,6 @@ static void _convert(Request& r, MethodP } bool negative=false; - bool sign=false; // converting digits to their numeric values @@ -659,11 +659,13 @@ static void _convert(Request& r, MethodP if(src[0]=='-') { negative=true; - sign=true; src++; + if(!*src || isspace(*src)) + throw Exception("number.format", 0, "'-' is invalid number"); } else if(src[0]=='+') { - sign=true; src++; + if(!*src || isspace(*src)) + throw Exception("number.format", 0, "'+' is invalid number"); } for(c=src;c