git-svn: trunk@2719
Nigel Horne authored on 2007/02/13 05:47:28... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Mon Feb 12 20:46:27 GMT 2007 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: Fix various gcc warnings |
|
4 |
+ * libclamav/mbox.c: sanitise rfc1341 names |
|
5 |
+ |
|
1 | 6 |
Mon Feb 12 21:33:20 CET 2007 (tk) |
2 | 7 |
--------------------------------- |
3 | 8 |
* libclamav/phishcheck.c: fix hexurl regex (bb#288) |
... | ... |
@@ -84,7 +89,7 @@ Fri Feb 9 22:25:24 CET 2007 (tk) |
84 | 84 |
Fri Feb 9 21:12:28 CET 2007 (acab) |
85 | 85 |
----------------------------------- |
86 | 86 |
* libclamav: Fix win32 compilation error in upack and mew - thanks Nigel |
87 |
- |
|
87 |
+ |
|
88 | 88 |
Fri Feb 9 17:57:15 GMT 2007 (njh) |
89 | 89 |
---------------------------------- |
90 | 90 |
* libclamav/lockdb.c: Fix compilation error, bug 234 |
... | ... |
@@ -18,6 +18,9 @@ |
18 | 18 |
* |
19 | 19 |
* Change History: |
20 | 20 |
* $Log: binhex.c,v $ |
21 |
+ * Revision 1.23 2007/02/12 20:46:08 njh |
|
22 |
+ * Various tidy |
|
23 |
+ * |
|
21 | 24 |
* Revision 1.22 2006/07/31 09:19:52 njh |
22 | 25 |
* Use MAP_PRIVATE |
23 | 26 |
* |
... | ... |
@@ -82,7 +85,7 @@ |
82 | 82 |
* First draft of binhex.c |
83 | 83 |
* |
84 | 84 |
*/ |
85 |
-static char const rcsid[] = "$Id: binhex.c,v 1.22 2006/07/31 09:19:52 njh Exp $"; |
|
85 |
+static char const rcsid[] = "$Id: binhex.c,v 1.23 2007/02/12 20:46:08 njh Exp $"; |
|
86 | 86 |
|
87 | 87 |
#include "clamav.h" |
88 | 88 |
|
... | ... |
@@ -197,7 +200,7 @@ cli_binhex(const char *dir, int desc) |
197 | 197 |
cli_errmsg("No binhex line found\n"); |
198 | 198 |
return CL_EFORMAT; |
199 | 199 |
} |
200 |
- |
|
200 |
+ |
|
201 | 201 |
/* similar to binhexMessage */ |
202 | 202 |
messageSetEncoding(m, "x-binhex"); |
203 | 203 |
|
... | ... |
@@ -16,7 +16,7 @@ |
16 | 16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
17 | 17 |
* MA 02110-1301, USA. |
18 | 18 |
*/ |
19 |
-static char const rcsid[] = "$Id: blob.c,v 1.62 2007/02/10 14:21:46 njh Exp $"; |
|
19 |
+static char const rcsid[] = "$Id: blob.c,v 1.63 2007/02/12 20:46:08 njh Exp $"; |
|
20 | 20 |
|
21 | 21 |
#if HAVE_CONFIG_H |
22 | 22 |
#include "clamav-config.h" |
... | ... |
@@ -272,7 +272,7 @@ blobClose(blob *b) |
272 | 272 |
free(b->data); |
273 | 273 |
b->data = NULL; |
274 | 274 |
cli_dbgmsg("blobClose: recovered all %lu bytes\n", |
275 |
- b->size); |
|
275 |
+ (unsigned long)b->size); |
|
276 | 276 |
b->size = 0; |
277 | 277 |
} else { |
278 | 278 |
unsigned char *ptr = cli_realloc(b->data, b->len); |
... | ... |
@@ -281,7 +281,8 @@ blobClose(blob *b) |
281 | 281 |
return; |
282 | 282 |
|
283 | 283 |
cli_dbgmsg("blobClose: recovered %lu bytes from %lu\n", |
284 |
- b->size - b->len, b->size); |
|
284 |
+ (unsigned long)(b->size - b->len), |
|
285 |
+ (unsigned long)b->size); |
|
285 | 286 |
b->size = b->len; |
286 | 287 |
b->data = ptr; |
287 | 288 |
} |
... | ... |
@@ -390,7 +391,8 @@ fileblobDestroy(fileblob *fb) |
390 | 390 |
cli_errmsg("fileblobDestroy: %s not saved: refer to http://www.clamav.net/bugs.html#pagestart\n", fb->b.name); |
391 | 391 |
free(fb->b.name); |
392 | 392 |
} else |
393 |
- cli_errmsg("fileblobDestroy: file not saved (%lu bytes): report to http://bugs.clamav.net\n", fb->b.len); |
|
393 |
+ cli_errmsg("fileblobDestroy: file not saved (%lu bytes): report to http://bugs.clamav.net\n", |
|
394 |
+ (unsigned long)fb->b.len); |
|
394 | 395 |
} |
395 | 396 |
#ifdef CL_DEBUG |
396 | 397 |
fb->b.magic = INVALIDCLASS; |
... | ... |
@@ -468,7 +470,8 @@ fileblobSetFilename(fileblob *fb, const char *dir, const char *filename) |
468 | 468 |
|
469 | 469 |
if(fd < 0) { |
470 | 470 |
cli_errmsg("Can't create temporary file %s: %s\n", fullname, strerror(errno)); |
471 |
- cli_dbgmsg("%d %d\n", sizeof(fullname), strlen(fullname)); |
|
471 |
+ cli_dbgmsg("%lu %lu\n", (unsigned long)sizeof(fullname), |
|
472 |
+ (unsigned long)strlen(fullname)); |
|
472 | 473 |
return; |
473 | 474 |
} |
474 | 475 |
|
... | ... |
@@ -478,7 +481,8 @@ fileblobSetFilename(fileblob *fb, const char *dir, const char *filename) |
478 | 478 |
|
479 | 479 |
if(fb->fp == NULL) { |
480 | 480 |
cli_errmsg("Can't create file %s: %s\n", fullname, strerror(errno)); |
481 |
- cli_dbgmsg("%d %d\n", sizeof(fullname), strlen(fullname)); |
|
481 |
+ cli_dbgmsg("%lu %lu\n", (unsigned long)sizeof(fullname), |
|
482 |
+ (unsigned long)strlen(fullname)); |
|
482 | 483 |
close(fd); |
483 | 484 |
|
484 | 485 |
return; |
... | ... |
@@ -528,7 +532,8 @@ fileblobAddData(fileblob *fb, const unsigned char *data, size_t len) |
528 | 528 |
#endif |
529 | 529 |
|
530 | 530 |
if(fwrite(data, len, 1, fb->fp) != 1) { |
531 |
- cli_errmsg("fileblobAddData: Can't write %u bytes to temporary file %s: %s\n", len, fb->b.name, strerror(errno)); |
|
531 |
+ cli_errmsg("fileblobAddData: Can't write %lu bytes to temporary file %s: %s\n", |
|
532 |
+ (unsigned long)len, fb->b.name, strerror(errno)); |
|
532 | 533 |
return -1; |
533 | 534 |
} |
534 | 535 |
fb->isNotEmpty = 1; |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* MA 02110-1301, USA. |
18 | 18 |
* |
19 | 19 |
* $Log: line.c,v $ |
20 |
+ * Revision 1.11 2007/02/12 20:46:08 njh |
|
21 |
+ * Various tidy |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.10 2006/04/09 19:59:27 kojm |
21 | 24 |
* update GPL headers with new address for FSF |
22 | 25 |
* |
... | ... |
@@ -49,7 +52,7 @@ |
49 | 49 |
* |
50 | 50 |
*/ |
51 | 51 |
|
52 |
-static char const rcsid[] = "$Id: line.c,v 1.10 2006/04/09 19:59:27 kojm Exp $"; |
|
52 |
+static char const rcsid[] = "$Id: line.c,v 1.11 2007/02/12 20:46:08 njh Exp $"; |
|
53 | 53 |
|
54 | 54 |
#if HAVE_CONFIG_H |
55 | 55 |
#include "clamav-config.h" |
... | ... |
@@ -110,7 +113,9 @@ lineGetData(const line_t *line) |
110 | 110 |
{ |
111 | 111 |
return line ? line->l_str : NULL; |
112 | 112 |
} |
113 |
+ |
|
113 | 114 |
#else |
115 |
+ |
|
114 | 116 |
line_t * |
115 | 117 |
lineCreate(const char *data) |
116 | 118 |
{ |
... | ... |
@@ -16,7 +16,7 @@ |
16 | 16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
17 | 17 |
* MA 02110-1301, USA. |
18 | 18 |
*/ |
19 |
-static char const rcsid[] = "$Id: mbox.c,v 1.373 2007/02/01 12:42:18 njh Exp $"; |
|
19 |
+static char const rcsid[] = "$Id: mbox.c,v 1.374 2007/02/12 20:46:08 njh Exp $"; |
|
20 | 20 |
|
21 | 21 |
#ifdef _MSC_VER |
22 | 22 |
#include <winsock.h> /* only needed in CL_EXPERIMENTAL */ |
... | ... |
@@ -138,7 +138,7 @@ typedef enum { |
138 | 138 |
* symbol in file |
139 | 139 |
* __floatdidf /opt/sfw/lib/libcurl.s |
140 | 140 |
*/ |
141 |
-#if C_SOLARIS && __GNUC__ |
|
141 |
+#if defined(C_SOLARIS) && defined(__GNUC__) |
|
142 | 142 |
#undef WITH_CURL |
143 | 143 |
#endif |
144 | 144 |
#endif |
... | ... |
@@ -466,8 +466,6 @@ static void add_to_map(const char *offset, const char *word); |
466 | 466 |
static const char *find_in_map(const char *offset, const char *word); |
467 | 467 |
static void free_map(void); |
468 | 468 |
|
469 |
- |
|
470 |
- |
|
471 | 469 |
/* |
472 | 470 |
* This could be the future. Instead of parsing and decoding it just decodes. |
473 | 471 |
* |
... | ... |
@@ -2061,8 +2059,8 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re |
2061 | 2061 |
if(mainMessage && (messageGetBody(mainMessage) != NULL)) { |
2062 | 2062 |
mime_type mimeType; |
2063 | 2063 |
int subtype, inhead, htmltextPart, inMimeHead, i; |
2064 |
- const char *mimeSubtype, *boundary; |
|
2065 |
- char *protocol; |
|
2064 |
+ const char *mimeSubtype; |
|
2065 |
+ char *protocol, *boundary; |
|
2066 | 2066 |
const text *t_line; |
2067 | 2067 |
/*bool isAlternative;*/ |
2068 | 2068 |
message *aMessage; |
... | ... |
@@ -2930,7 +2928,7 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re |
2930 | 2930 |
break; |
2931 | 2931 |
cli_dbgmsg("Save non mime part bounce message\n"); |
2932 | 2932 |
fileblobSetFilename(fb, mctx->dir, "bounce"); |
2933 |
- fileblobAddData(fb, (unsigned char *)"Received: by clamd (bounce)\n", 28); |
|
2933 |
+ fileblobAddData(fb, (const unsigned char *)"Received: by clamd (bounce)\n", 28); |
|
2934 | 2934 |
fileblobSetCTX(fb, mctx->ctx); |
2935 | 2935 |
|
2936 | 2936 |
inheader = TRUE; |
... | ... |
@@ -2945,9 +2943,9 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re |
2945 | 2945 |
} |
2946 | 2946 |
} else { |
2947 | 2947 |
s = lineGetData(l); |
2948 |
- fileblobAddData(fb, (unsigned char *)s, strlen(s)); |
|
2948 |
+ fileblobAddData(fb, (const unsigned char *)s, strlen(s)); |
|
2949 | 2949 |
} |
2950 |
- fileblobAddData(fb, (unsigned char *)"\n", 1); |
|
2950 |
+ fileblobAddData(fb, (const unsigned char *)"\n", 1); |
|
2951 | 2951 |
lookahead = t->t_next; |
2952 | 2952 |
if(lookahead == NULL) |
2953 | 2953 |
break; |
... | ... |
@@ -3061,7 +3059,8 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re |
3061 | 3061 |
static int |
3062 | 3062 |
boundaryStart(const char *line, const char *boundary) |
3063 | 3063 |
{ |
3064 |
- char *ptr, *out; |
|
3064 |
+ const char *ptr; |
|
3065 |
+ char *out; |
|
3065 | 3066 |
int rc; |
3066 | 3067 |
char buf[RFC2821LENGTH + 1]; |
3067 | 3068 |
|
... | ... |
@@ -3082,10 +3081,10 @@ boundaryStart(const char *line, const char *boundary) |
3082 | 3082 |
out = NULL; |
3083 | 3083 |
ptr = rfc822comments(line, buf); |
3084 | 3084 |
} else |
3085 |
- out = ptr = rfc822comments(line, NULL); |
|
3085 |
+ ptr = out = rfc822comments(line, NULL); |
|
3086 | 3086 |
|
3087 | 3087 |
if(ptr == NULL) |
3088 |
- ptr = (char *)line; |
|
3088 |
+ ptr = line; |
|
3089 | 3089 |
|
3090 | 3090 |
if(*ptr++ != '-') { |
3091 | 3091 |
if(out) |
... | ... |
@@ -3645,7 +3644,8 @@ rfc2047(const char *in) |
3645 | 3645 |
} |
3646 | 3646 |
b = messageToBlob(m, 1); |
3647 | 3647 |
len = blobGetDataSize(b); |
3648 |
- cli_dbgmsg("Decoded as '%*.*s'\n", len, len, blobGetData(b)); |
|
3648 |
+ cli_dbgmsg("Decoded as '%*.*s'\n", (int)len, (int)len, |
|
3649 |
+ blobGetData(b)); |
|
3649 | 3650 |
memcpy(pout, blobGetData(b), len); |
3650 | 3651 |
blobDestroy(b); |
3651 | 3652 |
messageDestroy(m); |
... | ... |
@@ -3710,7 +3710,7 @@ rfc1341(message *m, const char *dir) |
3710 | 3710 |
} |
3711 | 3711 |
if(statb.st_mode & 077) |
3712 | 3712 |
cli_warnmsg("Insecure partial directory %s (mode 0%o)\n", |
3713 |
- pdir, statb.st_mode & 0777); |
|
3713 |
+ pdir, (int)(statb.st_mode & 0777)); |
|
3714 | 3714 |
} |
3715 | 3715 |
|
3716 | 3716 |
number = (char *)messageFindArgument(m, "number"); |
... | ... |
@@ -3760,6 +3760,8 @@ rfc1341(message *m, const char *dir) |
3760 | 3760 |
char outname[NAME_MAX + 1]; |
3761 | 3761 |
time_t now; |
3762 | 3762 |
|
3763 |
+ sanitiseName(id); |
|
3764 |
+ |
|
3763 | 3765 |
snprintf(outname, sizeof(outname) - 1, "%s/%s", dir, id); |
3764 | 3766 |
|
3765 | 3767 |
cli_dbgmsg("outname: %s\n", outname); |
... | ... |
@@ -3796,8 +3798,8 @@ rfc1341(message *m, const char *dir) |
3796 | 3796 |
FILE *fin; |
3797 | 3797 |
char buffer[BUFSIZ], fullname[NAME_MAX + 1]; |
3798 | 3798 |
int nblanks; |
3799 |
- extern short cli_leavetemps_flag; |
|
3800 | 3799 |
struct stat statb; |
3800 |
+ extern short cli_leavetemps_flag; |
|
3801 | 3801 |
|
3802 | 3802 |
#ifndef C_CYGWIN |
3803 | 3803 |
if(dent->d_ino == 0) |
... | ... |
@@ -16,7 +16,7 @@ |
16 | 16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
17 | 17 |
* MA 02110-1301, USA. |
18 | 18 |
*/ |
19 |
-static char const rcsid[] = "$Id: message.c,v 1.194 2007/02/10 14:21:46 njh Exp $"; |
|
19 |
+static char const rcsid[] = "$Id: message.c,v 1.195 2007/02/12 20:46:09 njh Exp $"; |
|
20 | 20 |
|
21 | 21 |
#if HAVE_CONFIG_H |
22 | 22 |
#include "clamav-config.h" |
... | ... |
@@ -510,20 +510,20 @@ messageAddArguments(message *m, const char *s) |
510 | 510 |
continue; |
511 | 511 |
|
512 | 512 |
if(*cptr == '"') { |
513 |
- char *ptr; |
|
513 |
+ char *ptr, *kcopy; |
|
514 | 514 |
|
515 | 515 |
/* |
516 | 516 |
* The field is in quotes, so look for the |
517 | 517 |
* closing quotes |
518 | 518 |
*/ |
519 |
- key = cli_strdup(key); |
|
519 |
+ kcopy = cli_strdup(key); |
|
520 | 520 |
|
521 |
- if(key == NULL) |
|
521 |
+ if(kcopy == NULL) |
|
522 | 522 |
return; |
523 | 523 |
|
524 |
- ptr = strchr(key, '='); |
|
524 |
+ ptr = strchr(kcopy, '='); |
|
525 | 525 |
if(ptr == NULL) |
526 |
- ptr = strchr(key, ':'); |
|
526 |
+ ptr = strchr(kcopy, ':'); |
|
527 | 527 |
*ptr = '\0'; |
528 | 528 |
|
529 | 529 |
string = strchr(++cptr, '"'); |
... | ... |
@@ -534,8 +534,8 @@ messageAddArguments(message *m, const char *s) |
534 | 534 |
} else |
535 | 535 |
string++; |
536 | 536 |
|
537 |
- if(!usefulArg(key)) { |
|
538 |
- free((char *)key); |
|
537 |
+ if(!usefulArg(kcopy)) { |
|
538 |
+ free(kcopy); |
|
539 | 539 |
continue; |
540 | 540 |
} |
541 | 541 |
|
... | ... |
@@ -557,18 +557,18 @@ messageAddArguments(message *m, const char *s) |
557 | 557 |
cli_dbgmsg("Can't parse header \"%s\" - if you believe this file contains a virus, submit it to www.clamav.net\n", s); |
558 | 558 |
if(data) |
559 | 559 |
free(data); |
560 |
- free((char *)key); |
|
560 |
+ free(kcopy); |
|
561 | 561 |
return; |
562 | 562 |
} |
563 | 563 |
|
564 | 564 |
*ptr = '\0'; |
565 | 565 |
|
566 |
- field = cli_realloc((char *)key, strlen(key) + strlen(data) + 2); |
|
566 |
+ field = cli_realloc(kcopy, strlen(kcopy) + strlen(data) + 2); |
|
567 | 567 |
if(field) { |
568 | 568 |
strcat(field, "="); |
569 | 569 |
strcat(field, data); |
570 | 570 |
} else |
571 |
- free((char *)key); |
|
571 |
+ free(kcopy); |
|
572 | 572 |
free(data); |
573 | 573 |
} else { |
574 | 574 |
size_t len; |
... | ... |
@@ -614,7 +614,7 @@ messageGetArgument(const message *m, int arg) |
614 | 614 |
* Find a MIME variable from the header and return a COPY to the value of that |
615 | 615 |
* variable. The caller must free the copy |
616 | 616 |
*/ |
617 |
-const char * |
|
617 |
+char * |
|
618 | 618 |
messageFindArgument(const message *m, const char *variable) |
619 | 619 |
{ |
620 | 620 |
int i; |
... | ... |
@@ -632,8 +632,8 @@ messageFindArgument(const message *m, const char *variable) |
632 | 632 |
if((ptr == NULL) || (*ptr == '\0')) |
633 | 633 |
continue; |
634 | 634 |
#ifdef CL_DEBUG |
635 |
- cli_dbgmsg("messageFindArgument: compare %d bytes of %s with %s\n", |
|
636 |
- len, variable, ptr); |
|
635 |
+ cli_dbgmsg("messageFindArgument: compare %lu bytes of %s with %s\n", |
|
636 |
+ (unsigned long)len, variable, ptr); |
|
637 | 637 |
#endif |
638 | 638 |
if(strncasecmp(ptr, variable, len) == 0) { |
639 | 639 |
ptr = &ptr[len]; |
... | ... |
@@ -1222,7 +1222,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy |
1222 | 1222 |
blobAddData(u, &c, 1); |
1223 | 1223 |
} else { |
1224 | 1224 |
#ifdef CL_DEBUG |
1225 |
- cli_dbgmsg("uncompress HQX7 at 0x%06x: %d repetitive bytes\n", l, count); |
|
1225 |
+ cli_dbgmsg("uncompress HQX7 at 0x%06lu: %d repetitive bytes\n", l, count); |
|
1226 | 1226 |
#endif |
1227 | 1227 |
blobGrow(u, count); |
1228 | 1228 |
while(--count > 0) |
... | ... |
@@ -1385,13 +1385,15 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy |
1385 | 1385 |
* Find the filename to decode |
1386 | 1386 |
*/ |
1387 | 1387 |
if(((enctype == YENCODE) && yEncBegin(m)) || ((i == 0) && yEncBegin(m))) { |
1388 |
+ const char *f; |
|
1389 |
+ |
|
1388 | 1390 |
/* |
1389 | 1391 |
* TODO: handle multipart yEnc encoded files |
1390 | 1392 |
*/ |
1391 | 1393 |
t_line = yEncBegin(m); |
1392 |
- filename = (char *)lineGetData(t_line->t_line); |
|
1394 |
+ f = lineGetData(t_line->t_line); |
|
1393 | 1395 |
|
1394 |
- if((filename = strstr(filename, " name=")) != NULL) { |
|
1396 |
+ if((filename = strstr(f, " name=")) != NULL) { |
|
1395 | 1397 |
filename = cli_strdup(&filename[6]); |
1396 | 1398 |
if(filename) { |
1397 | 1399 |
cli_chomp(filename); |
... | ... |
@@ -1528,7 +1530,8 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy |
1528 | 1528 |
} |
1529 | 1529 |
} while((t_line = t_line->t_next) != NULL); |
1530 | 1530 |
|
1531 |
- cli_dbgmsg("Exported %u bytes using enctype %d\n", size, enctype); |
|
1531 |
+ cli_dbgmsg("Exported %lu bytes using enctype %d\n", |
|
1532 |
+ (unsigned long)size, enctype); |
|
1532 | 1533 |
|
1533 | 1534 |
/* Verify we have nothing left to flush out */ |
1534 | 1535 |
if(m->base64chars) { |
... | ... |
@@ -2387,7 +2390,7 @@ messageDedup(message *m) |
2387 | 2387 |
} |
2388 | 2388 |
} |
2389 | 2389 |
|
2390 |
- cli_dbgmsg("messageDedup reclaimed %u bytes\n", saved); |
|
2390 |
+ cli_dbgmsg("messageDedup reclaimed %lu bytes\n", (unsigned long)saved); |
|
2391 | 2391 |
m->dedupedThisFar = t1; |
2392 | 2392 |
} |
2393 | 2393 |
|
... | ... |
@@ -15,7 +15,7 @@ |
15 | 15 |
* along with this program; if not, write to the Free Software |
16 | 16 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | 17 |
*/ |
18 |
-static char const rcsid[] = "$Id: pdf.c,v 1.60 2007/02/10 14:21:46 njh Exp $"; |
|
18 |
+static char const rcsid[] = "$Id: pdf.c,v 1.61 2007/02/12 20:46:09 njh Exp $"; |
|
19 | 19 |
|
20 | 20 |
#if HAVE_CONFIG_H |
21 | 21 |
#include "clamav-config.h" |
... | ... |
@@ -50,7 +50,7 @@ static char const rcsid[] = "$Id: pdf.c,v 1.60 2007/02/10 14:21:46 njh Exp $"; |
50 | 50 |
#include "mbox.h" |
51 | 51 |
#include "pdf.h" |
52 | 52 |
|
53 |
-static int flatedecode(const unsigned char *buf, off_t len, int fout, const cli_ctx *ctx); |
|
53 |
+static int flatedecode(unsigned char *buf, off_t len, int fout, const cli_ctx *ctx); |
|
54 | 54 |
static int ascii85decode(const char *buf, off_t len, unsigned char *output); |
55 | 55 |
static const char *pdf_nextlinestart(const char *ptr, size_t len); |
56 | 56 |
static const char *pdf_nextobject(const char *ptr, size_t len); |
... | ... |
@@ -89,7 +89,7 @@ cli_pdf(const char *dir, int desc, const cli_ctx *ctx) |
89 | 89 |
if(buf == MAP_FAILED) |
90 | 90 |
return CL_EMEM; |
91 | 91 |
|
92 |
- cli_dbgmsg("cli_pdf: scanning %lu bytes\n", size); |
|
92 |
+ cli_dbgmsg("cli_pdf: scanning %lu bytes\n", (unsigned long)size); |
|
93 | 93 |
|
94 | 94 |
/* Lines are terminated by \r, \n or both */ |
95 | 95 |
|
... | ... |
@@ -355,7 +355,7 @@ cli_pdf(const char *dir, int desc, const cli_ctx *ctx) |
355 | 355 |
if(zstat != Z_OK) |
356 | 356 |
rc = CL_EZIP; |
357 | 357 |
} else |
358 |
- cli_writen(fout, (char *)streamstart, streamlen); |
|
358 |
+ cli_writen(fout, (const char *)streamstart, streamlen); |
|
359 | 359 |
} |
360 | 360 |
free(tmpbuf); |
361 | 361 |
} else if(is_flatedecode) { |
... | ... |
@@ -364,9 +364,9 @@ cli_pdf(const char *dir, int desc, const cli_ctx *ctx) |
364 | 364 |
if(zstat != Z_OK) |
365 | 365 |
rc = CL_EZIP; |
366 | 366 |
} else { |
367 |
- cli_dbgmsg("cli_pdf: writing %u bytes from the stream\n", |
|
368 |
- streamlen); |
|
369 |
- cli_writen(fout, (char *)streamstart, streamlen); |
|
367 |
+ cli_dbgmsg("cli_pdf: writing %lu bytes from the stream\n", |
|
368 |
+ (unsigned long)streamlen); |
|
369 |
+ cli_writen(fout, (const char *)streamstart, streamlen); |
|
370 | 370 |
} |
371 | 371 |
|
372 | 372 |
close(fout); |
... | ... |
@@ -390,7 +390,7 @@ cli_pdf(const char *dir, int desc, const cli_ctx *ctx) |
390 | 390 |
|
391 | 391 |
/* flate inflation - returns zlib status, e.g. Z_OK */ |
392 | 392 |
static int |
393 |
-flatedecode(const unsigned char *buf, off_t len, int fout, const cli_ctx *ctx) |
|
393 |
+flatedecode(unsigned char *buf, off_t len, int fout, const cli_ctx *ctx) |
|
394 | 394 |
{ |
395 | 395 |
int zstat; |
396 | 396 |
off_t nbytes; |
... | ... |
@@ -402,7 +402,7 @@ flatedecode(const unsigned char *buf, off_t len, int fout, const cli_ctx *ctx) |
402 | 402 |
stream.zalloc = (alloc_func)Z_NULL; |
403 | 403 |
stream.zfree = (free_func)Z_NULL; |
404 | 404 |
stream.opaque = (void *)NULL; |
405 |
- stream.next_in = (unsigned char *)buf; |
|
405 |
+ stream.next_in = (Bytef *)buf; |
|
406 | 406 |
stream.avail_in = len; |
407 | 407 |
stream.next_out = output; |
408 | 408 |
stream.avail_out = sizeof(output); |
... | ... |
@@ -540,7 +540,8 @@ ascii85decode(const char *buf, off_t len, unsigned char *output) |
540 | 540 |
len = 0; |
541 | 541 |
break; |
542 | 542 |
} else if(!isspace(byte)) { |
543 |
- cli_warnmsg("ascii85Decode: invalid character 0x%x, len %lu\n", byte & 0xFF, len); |
|
543 |
+ cli_warnmsg("ascii85Decode: invalid character 0x%x, len %lu\n", |
|
544 |
+ byte & 0xFF, (unsigned long)len); |
|
544 | 545 |
return -1; |
545 | 546 |
} |
546 | 547 |
} |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* MA 02110-1301, USA. |
18 | 18 |
* |
19 | 19 |
* $Log: text.c,v $ |
20 |
+ * Revision 1.25 2007/02/12 20:46:09 njh |
|
21 |
+ * Various tidy |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.24 2006/09/13 20:53:50 njh |
21 | 24 |
* Added debug |
22 | 25 |
* |
... | ... |
@@ -82,7 +85,7 @@ |
82 | 82 |
* |
83 | 83 |
*/ |
84 | 84 |
|
85 |
-static char const rcsid[] = "$Id: text.c,v 1.24 2006/09/13 20:53:50 njh Exp $"; |
|
85 |
+static char const rcsid[] = "$Id: text.c,v 1.25 2007/02/12 20:46:09 njh Exp $"; |
|
86 | 86 |
|
87 | 87 |
#if HAVE_CONFIG_H |
88 | 88 |
#include "clamav-config.h" |
... | ... |
@@ -349,9 +352,9 @@ addToBlob(const line_t *line, void *arg) |
349 | 349 |
if(line) { |
350 | 350 |
const char *l = lineGetData(line); |
351 | 351 |
|
352 |
- blobAddData(b, (unsigned char *)l, strlen(l)); |
|
352 |
+ blobAddData(b, (const unsigned char *)l, strlen(l)); |
|
353 | 353 |
} |
354 |
- blobAddData(b, (unsigned char *)"\n", 1); |
|
354 |
+ blobAddData(b, (const unsigned char *)"\n", 1); |
|
355 | 355 |
} |
356 | 356 |
|
357 | 357 |
static void |
... | ... |
@@ -362,9 +365,9 @@ addToFileblob(const line_t *line, void *arg) |
362 | 362 |
if(line) { |
363 | 363 |
const char *l = lineGetData(line); |
364 | 364 |
|
365 |
- fileblobAddData(fb, (unsigned char *)l, strlen(l)); |
|
365 |
+ fileblobAddData(fb, (const unsigned char *)l, strlen(l)); |
|
366 | 366 |
} |
367 |
- fileblobAddData(fb, (unsigned char *)"\n", 1); |
|
367 |
+ fileblobAddData(fb, (const unsigned char *)"\n", 1); |
|
368 | 368 |
} |
369 | 369 |
|
370 | 370 |
static void * |
... | ... |
@@ -20,7 +20,7 @@ |
20 | 20 |
* Author: Charles G. Waldman (cgw@pgt.com), Aug 4 1998 |
21 | 21 |
* There are many tar files that this code cannot decode. |
22 | 22 |
*/ |
23 |
-static char const rcsid[] = "$Id: untar.c,v 1.34 2007/02/10 14:21:46 njh Exp $"; |
|
23 |
+static char const rcsid[] = "$Id: untar.c,v 1.35 2007/02/12 20:46:09 njh Exp $"; |
|
24 | 24 |
|
25 | 25 |
#if HAVE_CONFIG_H |
26 | 26 |
#include "clamav-config.h" |
... | ... |
@@ -223,7 +223,10 @@ cli_untar(const char *dir, int desc, unsigned int posix, const struct cl_limits |
223 | 223 |
|
224 | 224 |
if(fd < 0) { |
225 | 225 |
cli_errmsg("Can't create temporary file %s: %s\n", fullname, strerror(errno)); |
226 |
- cli_dbgmsg("%u %d %d\n", suffixLen, sizeof(fullname), strlen(fullname)); |
|
226 |
+ cli_dbgmsg("%lu %lu %lu\n", |
|
227 |
+ (unsigned long)suffixLen, |
|
228 |
+ (unsigned long)sizeof(fullname), |
|
229 |
+ (unsigned long)strlen(fullname)); |
|
227 | 230 |
return CL_ETMPFILE; |
228 | 231 |
} |
229 | 232 |
|