--- parser3/src/main/untaint.C 2001/10/19 12:43:30 1.69 +++ parser3/src/main/untaint.C 2001/11/05 11:46:29 1.74 @@ -2,9 +2,9 @@ Parser: String class part: untaint mechanizm. Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) + Author: Alexander Petrosyan (http://paf.design.ru) - $Id: untaint.C,v 1.69 2001/10/19 12:43:30 parser Exp $ + $Id: untaint.C,v 1.74 2001/11/05 11:46:29 paf Exp $ */ #include "pa_pool.h" @@ -148,7 +148,15 @@ inline bool need_quote_http_header(const @todo fix potential forigins_mode buf overrun */ size_t String::cstr_bufsize(Untaint_lang lang) const { - return (lang==UL_AS_IS?size():size()*UNTAINT_TIMES_BIGGER*(forigins_mode?10:1)) +1; + return ( + lang==UL_AS_IS? + size() + : + size() + *UNTAINT_TIMES_BIGGER + *(forigins_mode?10:1) + ) + +1; } /** @todo fix theoretical \n mem overrun in TYPO replacements @@ -164,11 +172,11 @@ char *String::store_to(char *dest, Untai const Chunk *chunk=&head; do { const Chunk::Row *row=chunk->rows; - for(size_t i=0; icount; i++, row++) { + for(uint i=0; icount; i++, row++) { if(row==append_here) goto break2; - Untaint_lang to_lang=lang==UL_UNSPECIFIED?row->item.lang:lang; + Untaint_lang to_lang=lang==UL_UNSPECIFIED?(Untaint_lang)row->item.lang:lang; char *dest_before_origins=dest; @@ -316,7 +324,7 @@ char *String::store_to(char *dest, Untai "untaint to user-html lang failed, no typo table"); char *html_for_typo= - (char *)malloc(row->item.size*2/* '\n' -> '\' 'n' */+1); + (char *)malloc(row->item.size*2/* '\n' -> '\' 'n' */+1,16); // note: // there still is a possibility that user // would not replace \n as she supposed to