summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <>2002-07-31 16:40:07 +0000
committerjason <>2002-07-31 16:40:07 +0000
commitc5c95eefd6134614711edfa693bb4aa5b5ee2a47 (patch)
tree94bfe0fe2a7603b2a5385718da8ca3e48c37e7a1
parentf85814b99411f07f87dbb2ec1977014aaa43a1c2 (diff)
downloadopenbsd-c5c95eefd6134614711edfa693bb4aa5b5ee2a47.tar.gz
openbsd-c5c95eefd6134614711edfa693bb4aa5b5ee2a47.tar.bz2
openbsd-c5c95eefd6134614711edfa693bb4aa5b5ee2a47.zip
Pull in patch from current:
Fix (deraadt): permit calloc(0, N) and calloc(N, 0) -- malloc(0) does the right thing
-rw-r--r--src/lib/libc/stdlib/calloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/calloc.c b/src/lib/libc/stdlib/calloc.c
index d8b2f0dd46..ab81ebfeda 100644
--- a/src/lib/libc/stdlib/calloc.c
+++ b/src/lib/libc/stdlib/calloc.c
@@ -32,7 +32,7 @@
32 */ 32 */
33 33
34#if defined(LIBC_SCCS) && !defined(lint) 34#if defined(LIBC_SCCS) && !defined(lint)
35static char *rcsid = "$OpenBSD: calloc.c,v 1.5.10.1 2002/07/30 14:51:20 jason Exp $"; 35static char *rcsid = "$OpenBSD: calloc.c,v 1.5.10.2 2002/07/31 16:40:07 jason Exp $";
36#endif /* LIBC_SCCS and not lint */ 36#endif /* LIBC_SCCS and not lint */
37 37
38#include <stdlib.h> 38#include <stdlib.h>
@@ -47,7 +47,7 @@ calloc(num, size)
47{ 47{
48 register void *p; 48 register void *p;
49 49
50 if (SIZE_T_MAX / num < size) { 50 if (num && size && SIZE_T_MAX / num < size) {
51 errno = ENOMEM; 51 errno = ENOMEM;
52 return NULL; 52 return NULL;
53 } 53 }