Browse Source

Pull in patch from current:

Fix (deraadt):
permit calloc(0, N) and calloc(N, 0) -- malloc(0) does the right thing
OPENBSD_3_1
jason 22 years ago
parent
commit
2109301afa
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/lib/libc/stdlib/calloc.c

+ 2
- 2
src/lib/libc/stdlib/calloc.c View File

@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: calloc.c,v 1.5.10.1 2002/07/30 14:51:20 jason Exp $";
static char *rcsid = "$OpenBSD: calloc.c,v 1.5.10.2 2002/07/31 16:40:07 jason Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdlib.h>
@ -47,7 +47,7 @@ calloc(num, size)
{
register void *p;
if (SIZE_T_MAX / num < size) {
if (num && size && SIZE_T_MAX / num < size) {
errno = ENOMEM;
return NULL;
}


Loading…
Cancel
Save