aboutsummaryrefslogtreecommitdiff
path: root/malloc/malloc.c
diff options
context:
space:
mode:
authorFrancois Goichon <fgoichon@google.com>2018-03-14 16:25:57 -0400
committerDJ Delorie <dj@redhat.com>2018-03-14 16:25:57 -0400
commitbdc3009b8ff0effdbbfb05eb6b10966753cbf9b8 (patch)
tree8b679dfecab99e1b57035687de5b190772107b39 /malloc/malloc.c
parentf9555d73121bd12f6fd50545868e6a33096b8164 (diff)
downloadglibc-bdc3009b8ff0effdbbfb05eb6b10966753cbf9b8.tar
glibc-bdc3009b8ff0effdbbfb05eb6b10966753cbf9b8.tar.gz
glibc-bdc3009b8ff0effdbbfb05eb6b10966753cbf9b8.tar.bz2
glibc-bdc3009b8ff0effdbbfb05eb6b10966753cbf9b8.zip
malloc: harden removal from unsorted list
* malloc/malloc.c (_int_malloc): Added check before removing from unsorted list.
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r--malloc/malloc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index e229181c5e..9614954975 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3775,6 +3775,8 @@ _int_malloc (mstate av, size_t bytes)
}
/* remove from unsorted list */
+ if (__glibc_unlikely (bck->fd != victim))
+ malloc_printerr ("malloc(): corrupted unsorted chunks 3");
unsorted_chunks (av)->bk = bck;
bck->fd = unsorted_chunks (av);