diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-08-06 03:28:45 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-08-06 03:28:45 +0000 |
commit | 64f78ef63be0e51e894ffd096de35c8a8f2ab034 (patch) | |
tree | bde240ac52cce20df63204506f4d4caa18dee723 /libc/stdlib/malloc/calloc.c | |
parent | 142d965177514ca28cd7536bb2c394485ec2c563 (diff) |
Unify calloc (its the same thing regardless of the underlying
malloc implementation). Fix problem reported to bugtraq about
problems with integer overflow that can occur during the
computation of the memory region size by calloc (and similar
functions) which could result in a subsequent buffer overflow.
-Erik
Diffstat (limited to 'libc/stdlib/malloc/calloc.c')
-rw-r--r-- | libc/stdlib/malloc/calloc.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/libc/stdlib/malloc/calloc.c b/libc/stdlib/malloc/calloc.c deleted file mode 100644 index 1cbab4ac5..000000000 --- a/libc/stdlib/malloc/calloc.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * libc/stdlib/malloc/calloc.c -- calloc function - * - * Copyright (C) 2002 NEC Corporation - * Copyright (C) 2002 Miles Bader <miles@gnu.org> - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - * - * Written by Miles Bader <miles@gnu.org> - */ - -#include <stdlib.h> -#include <string.h> - -#include "malloc.h" - - -void * -calloc (size_t size, size_t num) -{ - void *mem; - - size *= num; - - mem = malloc (size); - if (mem) - memset (mem, 0, size); - - return mem; -} |