summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2002-07-31 09:19:04 +0000
committerderaadt <deraadt@openbsd.org>2002-07-31 09:19:04 +0000
commit6f30274cd877795d63b2c551917cdea25c07391b (patch)
tree9b7f5face2ae232ce1b291b9ccd16d997f833fb2 /lib/libc/stdlib
parent#ifdef MOD_SSL for OpenSSL initialization (diff)
downloadwireguard-openbsd-6f30274cd877795d63b2c551917cdea25c07391b.tar.xz
wireguard-openbsd-6f30274cd877795d63b2c551917cdea25c07391b.zip
permit calloc(0, N) and calloc(N, 0) -- malloc(0) does the right thing; markus miod ok
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/calloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/calloc.c b/lib/libc/stdlib/calloc.c
index c53b22b4310..c75b256d146 100644
--- a/lib/libc/stdlib/calloc.c
+++ b/lib/libc/stdlib/calloc.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: calloc.c,v 1.6 2002/07/30 00:11:07 deraadt Exp $";
+static char *rcsid = "$OpenBSD: calloc.c,v 1.7 2002/07/31 09:19:04 deraadt 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;
}