Browse code

Don't normalize buffer shorter than 2 bytes.

git-svn: trunk@2760

Török Edvin authored on 2007/02/18 04:24:31
Showing 2 changed files
... ...
@@ -1,4 +1,7 @@
1 1
 Sat Feb 17 11:20:17 CET 2007 (edwin)
2
+  * libclamav/entconv.c: Don't normalize buffer shorter than 2 bytes.
3
+
4
+Sat Feb 17 11:20:17 CET 2007 (edwin)
2 5
   * libclamav/rtf.c: Fix possible memory leak, and add more sanity checks.
3 6
 
4 7
 Sat Feb 17 02:34:17 CET 2007 (acab)
... ...
@@ -807,7 +807,7 @@ static iconv_t iconv_open_cached(const unsigned char* fromcode)
807 807
 /* tmp_m_area and conv->out_area are of size maxlen */
808 808
 unsigned char* encoding_norm_readline(struct entity_conv* conv, FILE* stream_in, m_area_t* in_m_area, const size_t maxlen)
809 809
 {
810
-	if(!conv || !conv->out_area.buffer || !conv->tmp_area.buffer)
810
+	if(!conv || !conv->out_area.buffer || !conv->tmp_area.buffer || maxlen<2 )
811 811
 		return NULL;
812 812
 	else {
813 813
 		/* stream_in|in_m_area ->(read_raw) conv->tmp_area -> (iconv) conv->out_area -> (normalize) conv->norm_area -> (cli_readline) return value*/