git-svn: trunk@3434
Nigel Horne authored on 2007/12/19 02:04:41... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Tue Dec 18 16:25:22 GMT 2007 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/mbox.c: Fix warnings with various compilers |
|
4 |
+ |
|
1 | 5 |
Tue Dec 18 16:52:54 CET 2007 (acab) |
2 | 6 |
----------------------------------- |
3 | 7 |
* libclamav/unzip.c: Fix mmap leaks if tempfile fails |
... | ... |
@@ -265,8 +265,8 @@ static void *getURL(void *a); |
265 | 265 |
#else |
266 | 266 |
static void *getURL(struct arg *arg); |
267 | 267 |
#endif |
268 |
-static int nonblock_connect(int sock, const struct sockaddr_in *sin, const char *hostname); |
|
269 |
-static int connect_error(int sock, const char *hostname); |
|
268 |
+static int nonblock_connect(SOCKET sock, const struct sockaddr_in *sin, const char *hostname); |
|
269 |
+static int connect_error(SOCKET sock, const char *hostname); |
|
270 | 270 |
static int my_r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t len); |
271 | 271 |
|
272 | 272 |
#define NONBLOCK_SELECT_MAX_FAILURES 3 |
... | ... |
@@ -1513,7 +1513,7 @@ parseEmailFile(FILE *fin, const table_t *rfc821, const char *firstLine, const ch |
1513 | 1513 |
} |
1514 | 1514 |
if(inHeader) { |
1515 | 1515 |
cli_dbgmsg("parseEmailFile: check '%s' fullline %p\n", |
1516 |
- buffer ? buffer : "", fullline); |
|
1516 |
+ buffer, fullline); |
|
1517 | 1517 |
/* |
1518 | 1518 |
* Ensure wide characters are handled where |
1519 | 1519 |
* sizeof(char) > 1 |
... | ... |
@@ -4434,10 +4434,13 @@ getURL(struct arg *arg) |
4434 | 4434 |
fclose(fp); |
4435 | 4435 |
closesocket(sd); |
4436 | 4436 |
|
4437 |
- free(arg->url); |
|
4438 |
- arg->url = cli_strdup(location); |
|
4437 |
+ if(strlen(arg->url) < strlen(location)) { |
|
4438 |
+ free(arg->url); |
|
4439 |
+ arg->url = cli_strdup(location); |
|
4440 |
+ } else |
|
4441 |
+ strcpy(arg->url, location); |
|
4439 | 4442 |
arg->depth++; |
4440 |
- cli_dbgmsg("Redirecting to %s\n", arg->url); |
|
4443 |
+ cli_dbgmsg("Redirecting to %s\n", location); |
|
4441 | 4444 |
return getURL(arg); |
4442 | 4445 |
} |
4443 | 4446 |
} |
... | ... |
@@ -4537,7 +4540,7 @@ my_r_gethostbyname(const char *hostname, struct hostent *hp, char *buf, size_t l |
4537 | 4537 |
* FIXME: There are lots of copies of this code :-( |
4538 | 4538 |
*/ |
4539 | 4539 |
static int |
4540 |
-nonblock_connect(int sock, const struct sockaddr_in *sin, const char *hostname) |
|
4540 |
+nonblock_connect(SOCKET sock, const struct sockaddr_in *sin, const char *hostname) |
|
4541 | 4541 |
{ |
4542 | 4542 |
int select_failures; /* Max. of unexpected select() failures */ |
4543 | 4543 |
int attempts; |
... | ... |
@@ -4658,7 +4661,7 @@ nonblock_connect(int sock, const struct sockaddr_in *sin, const char *hostname) |
4658 | 4658 |
} |
4659 | 4659 |
|
4660 | 4660 |
static int |
4661 |
-connect_error(int sock, const char *hostname) |
|
4661 |
+connect_error(SOCKET sock, const char *hostname) |
|
4662 | 4662 |
{ |
4663 | 4663 |
#ifdef SO_ERROR |
4664 | 4664 |
int optval; |
... | ... |
@@ -4840,7 +4843,7 @@ isBounceStart(mbox_ctx *mctx, const char *line) |
4840 | 4840 |
return FALSE; |
4841 | 4841 |
return TRUE; |
4842 | 4842 |
} |
4843 |
- return cli_filetype((const unsigned char *)line, len, mctx->ctx->engine) == CL_TYPE_MAIL; |
|
4843 |
+ return (bool)(cli_filetype((const unsigned char *)line, len, mctx->ctx->engine) == CL_TYPE_MAIL); |
|
4844 | 4844 |
} |
4845 | 4845 |
|
4846 | 4846 |
/* |