aboutsummaryrefslogtreecommitdiff
path: root/malloc
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-07 19:32:54 +0000
committerRoland McGrath <roland@gnu.org>2002-08-07 19:32:54 +0000
commit0be405c239d30aeb1c822740e844fb856ec3639e (patch)
treee4fb0c0f2066e2adf5a4b78e0fa02a248a373dc6 /malloc
parente78f615d52703ec18f773e3778d0dbfc6aa3be35 (diff)
downloadglibc-0be405c239d30aeb1c822740e844fb856ec3639e.zip
glibc-0be405c239d30aeb1c822740e844fb856ec3639e.tar.gz
glibc-0be405c239d30aeb1c822740e844fb856ec3639e.tar.bz2
2002-08-07 Jakub Jelinek <jakub@redhat.com>
* malloc/malloc.c (public_cALLOc): Check ELEM_SIZE != 0 before division. * include/getopt.h: Put private decls inside [_GETOPT_H].
Diffstat (limited to 'malloc')
-rw-r--r--malloc/malloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 6855149..b6fd367 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3474,7 +3474,7 @@ public_cALLOc(size_t n, size_t elem_size)
#define HALF_INTERNAL_SIZE_T \
(((INTERNAL_SIZE_T) 1) << (8 * sizeof (INTERNAL_SIZE_T) / 2))
if (__builtin_expect ((n | elem_size) >= HALF_INTERNAL_SIZE_T, 0)) {
- if (bytes / elem_size != n) {
+ if (elem_size != 0 && bytes / elem_size != n) {
MALLOC_FAILURE_ACTION;
return 0;
}