--- parser3/src/classes/string.C 2019/11/13 22:05:48 1.241 +++ parser3/src/classes/string.C 2019/11/20 20:48:25 1.243 @@ -21,7 +21,7 @@ #include "pa_vregex.h" #include "pa_charsets.h" -volatile const char * IDENT_STRING_C="$Id: string.C,v 1.241 2019/11/13 22:05:48 moko Exp $"; +volatile const char * IDENT_STRING_C="$Id: string.C,v 1.243 2019/11/20 20:48:25 moko Exp $"; // class @@ -701,15 +701,14 @@ static void _base64(Request& r, MethodPa Base64Options options = base64_decode_options(r, params.count() > 1 ? params.as_hash(1) : NULL); char* decoded=0; - size_t length=0; - - pa_base64_decode(cstr, strlen(cstr), decoded, length, options); + size_t length=pa_base64_decode(cstr, strlen(cstr), decoded, options); if(decoded && length){ - if(memchr((const char*)decoded, 0, length)) - throw Exception(PARSER_RUNTIME, 0, "Invalid \\x00 character found while decode to string. Decode it to file instead."); + if(memchr(decoded, 0, length)) + throw Exception(PARSER_RUNTIME, 0, "Invalid \\x00 character found while decoding to string. Decode to file instead."); fix_line_breaks(decoded, length); + if(length) r.write(*new String(decoded, String::L_TAINTED)); }