git-svn: trunk@3539
Török Edvin authored on 2008/01/25 17:37:13... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Fri Jan 25 10:14:23 EET 2008 (edwin) |
|
2 |
+------------------------------------ |
|
3 |
+ * libclamav/entconv.[ch]: make iconv replacement function handle NULL args |
|
4 |
+ (bb #792) |
|
5 |
+ |
|
1 | 6 |
Thu Jan 24 13:35:51 GMT 2008 (njh) |
2 | 7 |
---------------------------------- |
3 | 8 |
* libclamav/mbox.c: Use cli_strcasestr |
... | ... |
@@ -24,4 +24,4 @@ encname_chars.h: gentbl |
24 | 24 |
./gentbl encname_chars 0-9 a-z A-Z _ . / \( \) - : >$@ |
25 | 25 |
|
26 | 26 |
clean: |
27 |
- rm -f entitylist.h encoding_aliases.h entities_parsed generate_entitylist generate_encoding_aliases gentbl |
|
27 |
+ rm -f entitylist.h encoding_aliases.h entities_parsed generate_entitylist generate_encoding_aliases gentbl encname_chars.h |
... | ... |
@@ -240,10 +240,15 @@ static int iconv_close(iconv_t cd) |
240 | 240 |
static int iconv(iconv_t iconv_struct,char **inbuf, size_t *inbytesleft, |
241 | 241 |
char** outbuf, size_t *outbytesleft) |
242 | 242 |
{ |
243 |
- const size_t maxcopy = (*inbytesleft > *outbytesleft ? *outbytesleft : *inbytesleft) & ~(iconv_struct->size - 1); |
|
244 |
- const uint8_t* input = (const uint8_t*)*inbuf; |
|
245 |
- uint8_t* output = (uint8_t*)*outbuf; |
|
246 |
- size_t i; |
|
243 |
+ const uint8_t* input; |
|
244 |
+ uint8_t* output; |
|
245 |
+ size_t maxcopy, i; |
|
246 |
+ if(!inbuf || !outbuf) { |
|
247 |
+ return 0; |
|
248 |
+ } |
|
249 |
+ maxcopy = (*inbytesleft > *outbytesleft ? *outbytesleft : *inbytesleft) & ~(iconv_struct->size - 1); |
|
250 |
+ input = (const uint8_t*)*inbuf; |
|
251 |
+ output = (uint8_t*)*outbuf; |
|
247 | 252 |
|
248 | 253 |
/*,maxcopy is aligned to data size */ |
249 | 254 |
/* output is always utf16be !*/ |
... | ... |
@@ -1066,6 +1071,7 @@ unsigned char* encoding_norm_readline(struct entity_conv* conv, FILE* stream_in, |
1066 | 1066 |
|
1067 | 1067 |
if(limit < 0) limit = 0; |
1068 | 1068 |
conv->out_area.buffer[conv->out_area.length - limit - 1] = '\0'; |
1069 |
+ puts(conv->out_area.buffer); |
|
1069 | 1070 |
return conv->out_area.buffer; |
1070 | 1071 |
} |
1071 | 1072 |
} |