--- parser3/src/main/untaint.C 2010/12/29 12:17:58 1.161 +++ parser3/src/main/untaint.C 2012/05/17 10:54:03 1.164 @@ -1,11 +1,11 @@ /** @file Parser: String class part: untaint mechanizm. - Copyright(c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_UNTAINT_C="$Date: 2010/12/29 12:17:58 $"; +volatile const char * IDENT_UNTAINT_C="$Id: untaint.C,v 1.164 2012/05/17 10:54:03 misha Exp $"; #include "pa_string.h" @@ -74,7 +74,7 @@ inline bool need_file_encode(unsigned ch // russian letters and space ENABLED // encoding only these... return strchr( - "*?'\"<>|" + "*?\"<>|" #ifndef WIN32 ":\\" #endif @@ -82,10 +82,7 @@ inline bool need_file_encode(unsigned ch } inline bool need_uri_encode(unsigned char c){ - if((c>='0') && (c<='9') || (c>='A') && (c<='Z') || (c>='a') && (c<='z')) - return false; - - return !strchr("_-./*", c); + return !(pa_isalnum(c) || strchr("_-./*", c)); } inline bool need_regex_escape(unsigned char c){ @@ -251,10 +248,7 @@ RFC and without "_", or in would mean 0x20 */ inline bool mail_header_char_valid_within_Qencoded(char c) { - return c>='A' && c<='Z' - || c>='a' && c<='Z' - || c>='0' && c<='9' - || strchr("!*+-/", c); + return (pa_isalnum((unsigned char)c) || strchr("!*+-/", c)); } inline bool addr_spec_soon(const char *src) { for(char c; (c=*src); src++)