Check for 0 byte allocations in cli_(m|c|re)alloc

git-svn: trunk@1650
remotes/push_mirror/metadata
Tomasz Kojm 21 years ago
parent 93e155f638
commit f67d502907
  1. 4
      clamav-devel/ChangeLog
  2. 9
      clamav-devel/libclamav/others.c

@ -1,3 +1,7 @@
Sat Jul 16 17:02:53 CEST 2005 (tk)
----------------------------------
* libclamav/others.c: Check for 0 byte allocations in cli_(m|c|re)alloc
Fri Jul 15 11:19:54 BST 2005 (trog)
-----------------------------------
* libclamav/chmunpack.c: Fix possible malloc overflow. Reported by Alex Wheeler.

@ -308,7 +308,7 @@ void *cli_malloc(size_t size)
void *alloc;
if(size > MAX_ALLOCATION) {
if(!size || size > MAX_ALLOCATION) {
cli_errmsg("Attempt to allocate %d bytes. Please report to bugs@clamav.net\n", size);
return NULL;
}
@ -328,7 +328,7 @@ void *cli_calloc(size_t nmemb, size_t size)
void *alloc;
if(size > MAX_ALLOCATION) {
if(!size || size > MAX_ALLOCATION) {
cli_errmsg("Attempt to allocate %d bytes. Please report to bugs@clamav.net\n", size);
return NULL;
}
@ -348,6 +348,11 @@ void *cli_realloc(void *ptr, size_t size)
void *alloc;
if(!size || size > MAX_ALLOCATION) {
cli_errmsg("Attempt to allocate %d bytes. Please report to bugs@clamav.net\n", size);
return NULL;
}
alloc = realloc(ptr, size);
if(!alloc) {

Loading…
Cancel
Save