--- parser3/src/main/untaint.C 2016/10/26 16:40:50 1.171 +++ parser3/src/main/untaint.C 2023/09/26 20:49:10 1.177 @@ -1,11 +1,11 @@ /** @file Parser: String class part: untaint mechanizm. - Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ -volatile const char * IDENT_UNTAINT_C="$Id: untaint.C,v 1.171 2016/10/26 16:40:50 moko Exp $"; +volatile const char * IDENT_UNTAINT_C="$Id: untaint.C,v 1.177 2023/09/26 20:49:10 moko Exp $"; #include "pa_string.h" @@ -20,7 +20,7 @@ volatile const char * IDENT_UNTAINT_C="$ #include "pa_sapi.h" extern "C" { // author forgot to do that -#include "ec.h" +#include "../lib/cord/include/ec.h" } #include "pa_sql_connection.h" @@ -403,17 +403,17 @@ int cstr_to_string_body_block(String::La bool email=false; uchar c; - for(const char* src=mail_ptr; (c=(uchar)*src++); ) { + for(const char* src=mail_ptr; c=(uchar)*src; src++) { if(c=='\r' || c=='\n') c=' '; - if(to_quoted_printable && (c==',' || c == '"' || addr_spec_soon(src-1/*position to 'c'*/))) { + if(to_quoted_printable && (c==',' || c == '"' || addr_spec_soon(src))) { email=c=='<'; to_string("?="); to_quoted_printable=false; } //RFC + An 'encoded-word' MUST NOT appear in any portion of an 'addr-spec'. if(!email && ( - ( !to_quoted_printable && (c & 0x80) ) // starting quote-printable-encoding on first 8bit char + ( !to_quoted_printable && (c & 0x80 || (c == ' ' && src == mail_ptr) ) ) // starting quote-printable-encoding on first 8bit char or leading space (issue #123) || ( to_quoted_printable && !mail_header_char_valid_within_Qencoded(c) ) )) { if(!to_quoted_printable) { @@ -579,8 +579,7 @@ int cstr_to_string_body_block(String::La ); break; default: - SAPI::abort("unknown untaint language #%d", - static_cast(to_lang)); // should never + SAPI::die("unknown untaint language #%d", static_cast(to_lang)); // should never break; // never }