Fix logic error in blobClose

git-svn: trunk@571
remotes/push_mirror/metadata
Nigel Horne 22 years ago
parent ea4465c4e1
commit d1bd254788
  1. 12
      clamav-devel/ChangeLog
  2. 32
      clamav-devel/libclamav/blob.c

@ -1,7 +1,11 @@
Fri May 21 12:32:24 BST 2004 (njh)
----------------------------------
* libclamav/blob.c: Fixed logic error in blobClose()
Fri May 21 10:16:27 BST 2004 (njh)
----------------------------------
* clamav-milter: --from wasn't always recognised
write failures to quarantine area were not correctly
write failures to quarantine area were not correctly
reported
Thu May 20 11:23:23 BST 2004 (trog)
@ -11,7 +15,7 @@ Thu May 20 11:23:23 BST 2004 (trog)
Wed May 19 11:02:53 BST 2004 (njh)
---------------------------------
* libclamav/message.c: Assume attachments which don't declare how
they've been encoded are base64
they've been encoded are base64
Wed May 19 09:10:12 BST 2004 (trog)
-----------------------------------
@ -71,7 +75,7 @@ Tue May 11 02:07:55 CEST 2004 (tk)
Mon May 10 12:25:09 BST 2004 (njh)
----------------------------------
* libclamav: Don't call cli_filetype() so often since the latest
chanves give false positives about the start of bounce messages
chanves give false positives about the start of bounce messages
which opens up DoS attacks, and allows worms hidden in bounce
messages to be hidden with ease
@ -101,7 +105,7 @@ Sun May 9 18:40:55 BST 2004 (njh)
Also added X-Infected-Received-From: header by Sergey
Report an error if inet_ntop fails in tcp_wrappers
* docs/man: Clarified suggested use of max-children only on
small machines
small machines
Fri May 7 19:46:05 CEST 2004 (tk)
----------------------------------

@ -16,6 +16,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: blob.c,v $
* Revision 1.12 2004/05/21 11:31:48 nigelhorne
* Fix logic error in blobClose
*
* Revision 1.11 2004/04/17 14:18:58 nigelhorne
* Some filenames not scanned in MACOS/X
*
@ -35,7 +38,7 @@
* Change LOG to Log
*
*/
static char const rcsid[] = "$Id: blob.c,v 1.11 2004/04/17 14:18:58 nigelhorne Exp $";
static char const rcsid[] = "$Id: blob.c,v 1.12 2004/05/21 11:31:48 nigelhorne Exp $";
#if HAVE_CONFIG_H
#include "clamav-config.h"
@ -107,8 +110,6 @@ blobArrayDestroy(blob *blobList[], int n)
void
blobSetFilename(blob *b, const char *filename)
{
char *ptr;
assert(b != NULL);
assert(b->magic == BLOB);
assert(filename != NULL);
@ -117,7 +118,9 @@ blobSetFilename(blob *b, const char *filename)
free(b->name);
b->name = strdup(filename);
if(b->name)
if(b->name) {
char *ptr;
for(ptr = b->name; *ptr; ptr++) {
#if defined(MSDOS) || defined(C_CYGWIN) || defined(WIN32)
if(strchr("*?<>|\"+=,;: ", *ptr))
@ -128,6 +131,7 @@ blobSetFilename(blob *b, const char *filename)
#endif
*ptr = '_';
}
}
cli_dbgmsg("blobSetFilename: %s\n", filename);
}
@ -197,12 +201,15 @@ blobGetDataSize(const blob *b)
void
blobClose(blob *b)
{
b->isClosed = 1;
if(b->size > b->len) {
unsigned char *ptr = cli_realloc(b->data, b->len);
if(b->size != b->len) {
if(ptr == NULL)
return;
b->size = b->len;
b->data = cli_realloc(b->data, b->size);
b->data = ptr;
}
b->isClosed = 1;
}
/*
@ -249,10 +256,15 @@ blobGrow(blob *b, size_t len)
assert(b->len == 0);
assert(b->size == 0);
b->size = len;
b->data = cli_malloc(len);
if(b->data)
b->size = len;
} else {
b->size += len;
b->data = cli_realloc(b->data, b->size);
unsigned char *ptr = cli_realloc(b->data, b->size + len);
if(ptr) {
b->size += len;
b->data = ptr;
}
}
}

Loading…
Cancel
Save