git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1333 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2005/02/13 18:34:40... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Sun Feb 13 09:32:51 GMT 2005 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/message.c: Some files wouldn't uudecode correctly (reported |
|
4 |
+ by Jerome Limozin <jerome at limozin.net>) |
|
5 |
+ |
|
1 | 6 |
Fri Feb 11 22:21:44 GMT 2005 (njh) |
2 | 7 |
---------------------------------- |
3 | 8 |
* clamav-milter: Added --whistlist-file and --sendmail-cf options |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: message.c,v $ |
20 |
+ * Revision 1.143 2005/02/13 09:31:36 nigelhorne |
|
21 |
+ * Some lines wouldn't uudecode correctly |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.142 2005/02/06 09:22:11 nigelhorne |
21 | 24 |
* Improved debug statements |
22 | 25 |
* |
... | ... |
@@ -423,7 +426,7 @@ |
423 | 423 |
* uuencodebegin() no longer static |
424 | 424 |
* |
425 | 425 |
*/ |
426 |
-static char const rcsid[] = "$Id: message.c,v 1.142 2005/02/06 09:22:11 nigelhorne Exp $"; |
|
426 |
+static char const rcsid[] = "$Id: message.c,v 1.143 2005/02/13 09:31:36 nigelhorne Exp $"; |
|
427 | 427 |
|
428 | 428 |
#if HAVE_CONFIG_H |
429 | 429 |
#include "clamav-config.h" |
... | ... |
@@ -2262,7 +2265,7 @@ messageClearMarkers(message *m) |
2262 | 2262 |
static unsigned char * |
2263 | 2263 |
decodeLine(message *m, encoding_type et, const char *line, unsigned char *buf, size_t buflen) |
2264 | 2264 |
{ |
2265 |
- size_t len; |
|
2265 |
+ size_t len, reallen; |
|
2266 | 2266 |
bool softbreak; |
2267 | 2267 |
char *p2, *copy; |
2268 | 2268 |
char base64buf[RFC2045LENGTH + 1]; |
... | ... |
@@ -2369,9 +2372,10 @@ decodeLine(message *m, encoding_type et, const char *line, unsigned char *buf, s |
2369 | 2369 |
if((line[0] & 0x3F) == ' ') |
2370 | 2370 |
break; |
2371 | 2371 |
|
2372 |
- /* Don't trust the encoded length */ |
|
2373 |
- /*len = *line++ - ' ';*/ |
|
2374 |
- len = strlen(++line); |
|
2372 |
+ reallen = (size_t)uudecode(*line++); |
|
2373 |
+ if(reallen == 0) |
|
2374 |
+ break; |
|
2375 |
+ len = strlen(line); |
|
2375 | 2376 |
|
2376 | 2377 |
if(len > buflen) |
2377 | 2378 |
/* |
... | ... |
@@ -2380,8 +2384,10 @@ decodeLine(message *m, encoding_type et, const char *line, unsigned char *buf, s |
2380 | 2380 |
* 62 characters |
2381 | 2381 |
*/ |
2382 | 2382 |
cli_warnmsg("uudecode: buffer overflow stopped, attempting to ignore but decoding may fail\n"); |
2383 |
- else |
|
2384 |
- buf = decode(m, line, buf, uudecode, (len & 3) == 0); |
|
2383 |
+ else { |
|
2384 |
+ (void)decode(m, line, buf, uudecode, (len & 3) == 0); |
|
2385 |
+ buf = &buf[reallen]; |
|
2386 |
+ } |
|
2385 | 2387 |
break; |
2386 | 2388 |
case YENCODE: |
2387 | 2389 |
if((line == NULL) || (*line == '\0')) /* empty line */ |