diff options
author | Jim Meyering <meyering@redhat.com> | 2010-07-14 11:05:50 -0500 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-07-14 11:05:50 -0500 |
commit | c5e350ec5625d7346c2a088fe478060358200c14 (patch) | |
tree | 496bd013993f06880ff013775909227d7e4bf1c7 /gl | |
parent | 66af887e57f6d4f485cf68fc16e9558781b648b6 (diff) | |
download | coreutils-c5e350ec5625d7346c2a088fe478060358200c14.tar.xz |
heap_alloc: avoid integer overflow
* gl/lib/heap.c (heap_alloc): Use xnmalloc rather than xmalloc,
to avoid pathological overflow.
Diffstat (limited to 'gl')
-rw-r--r-- | gl/lib/heap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gl/lib/heap.c b/gl/lib/heap.c index 1de3391a5..4672b6d5b 100644 --- a/gl/lib/heap.c +++ b/gl/lib/heap.c @@ -41,7 +41,7 @@ heap_alloc (int (*compare)(const void *, const void *), size_t n_reserve) if (n_reserve == 0) n_reserve = 1; - heap->array = xmalloc (n_reserve * sizeof *(heap->array)); + heap->array = xnmalloc (n_reserve, sizeof *(heap->array)); heap->array[0] = NULL; heap->capacity = n_reserve; |