--- parser3/src/classes/math.C 2013/08/21 14:41:24 1.69 +++ parser3/src/classes/math.C 2015/05/08 15:52:53 1.73 @@ -22,7 +22,7 @@ extern "C" char *crypt(const char* , const char* ); #endif -volatile const char * IDENT_MATH_C="$Id: math.C,v 1.69 2013/08/21 14:41:24 moko Exp $"; +volatile const char * IDENT_MATH_C="$Id: math.C,v 1.73 2015/05/08 15:52:53 moko Exp $"; // defines @@ -101,7 +101,7 @@ static void math2(Request& r, MethodPara MATH2(pow); inline bool is_salt_body_char(int c) { - return isalnum(c) || c == '.' || c=='/'; + return pa_isalnum(c) || c == '.' || c=='/'; } static size_t calc_prefix_size(const char* salt) { if(strlen(salt)) { @@ -164,7 +164,7 @@ static void _crypt(Request& r, MethodPar } static void _md5(Request& r, MethodParams& params) { - const char *string=params.as_string(0, PARAMETER_MUST_BE_STRING).cstr(); + const char *string=params.as_string(0, PARAMETER_MUST_BE_STRING).cstr_to_string_body_untaint(String::L_AS_IS, r.connection(false), &r.charsets).cstr(); PA_MD5_CTX context; unsigned char digest[16]; @@ -316,7 +316,7 @@ void SHA1ReadDigest(void *buf, SHA1Conte } static void _sha1(Request& r, MethodParams& params) { - const char *string = params.as_string(0, PARAMETER_MUST_BE_STRING).cstr(); + const char *string = params.as_string(0, PARAMETER_MUST_BE_STRING).cstr_to_string_body_untaint(String::L_AS_IS, r.connection(false), &r.charsets).cstr(); SHA1Context c; unsigned char digest[20]; @@ -368,7 +368,7 @@ static void _digest(Request& r, MethodPa String::C data; if(const String* sdata=vdata.get_string()){ - String::Body body=sdata->cstr_to_string_body_untaint(String::L_AS_IS); // explode content, honor tainting changes + String::Body body=sdata->cstr_to_string_body_untaint(String::L_AS_IS, r.connection(false), &r.charsets); // explode content, honor tainting changes data=String::C(body.cstr(), body.length()); } else { VFile *file=vdata.as_vfile(String::L_AS_IS); @@ -574,7 +574,7 @@ MMath::MMath(): Methoded("math") { // ^math:sha1[string] ADD1(sha1); - // ^math:digest[method;string;options] + // ^math:digest[method;string|file;options] add_native_method("digest", Method::CT_STATIC, _digest, 2, 3); // ^math:crc32[string]