summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-08-12 08:49:00 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-08-12 08:49:00 +0000
commit603945d8e7e21f759268960f6c5bb4198d1bfeec (patch)
tree8e9081df26ab028f7421f0f8ee3b22aa2dcc8787
parentca77cc963b66a482374ac7cd83dd7aafd15f56f6 (diff)
fake out malloc(0)
-rw-r--r--lib/libz/zutil.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libz/zutil.c b/lib/libz/zutil.c
index 7846ce94c2a..32d074e5cb7 100644
--- a/lib/libz/zutil.c
+++ b/lib/libz/zutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zutil.c,v 1.4 2000/03/02 00:29:52 todd Exp $ */
+/* $OpenBSD: zutil.c,v 1.5 2001/08/12 08:48:59 deraadt Exp $ */
/* zutil.c -- target dependent utility functions for the compression library
* Copyright (C) 1995-1998 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -211,6 +211,8 @@ voidpf zcalloc (opaque, items, size)
unsigned size;
{
if (opaque) items += size - size; /* make compiler happy */
+ if (items * size == 0)
+ return (NULL);
return (voidpf)calloc(items, size);
}