Blame SOURCES/glibc-rh1651283-1.patch
|
|
d8307d |
commit d6db68e66dff25d12c3bc5641b60cbd7fb6ab44f
|
|
|
d8307d |
Author: Moritz Eckert <m.eckert@cs.ucsb.edu>
|
|
|
d8307d |
Date: Thu Aug 16 21:08:36 2018 -0400
|
|
|
d8307d |
|
|
|
d8307d |
malloc: Mitigate null-byte overflow attacks
|
|
|
d8307d |
|
|
|
d8307d |
* malloc/malloc.c (_int_free): Check for corrupt prev_size vs size.
|
|
|
d8307d |
(malloc_consolidate): Likewise.
|
|
|
d8307d |
|
|
|
d8307d |
diff --git a/malloc/malloc.c b/malloc/malloc.c
|
|
|
d8307d |
index 13c52f376859562d..e450597e2e527fb7 100644
|
|
|
d8307d |
--- a/malloc/malloc.c
|
|
|
d8307d |
+++ b/malloc/malloc.c
|
|
|
d8307d |
@@ -4306,6 +4306,8 @@ _int_free (mstate av, mchunkptr p, int have_lock)
|
|
|
d8307d |
prevsize = prev_size (p);
|
|
|
d8307d |
size += prevsize;
|
|
|
d8307d |
p = chunk_at_offset(p, -((long) prevsize));
|
|
|
d8307d |
+ if (__glibc_unlikely (chunksize(p) != prevsize))
|
|
|
d8307d |
+ malloc_printerr ("corrupted size vs. prev_size while consolidating");
|
|
|
d8307d |
unlink(av, p, bck, fwd);
|
|
|
d8307d |
}
|
|
|
d8307d |
|
|
|
d8307d |
@@ -4467,6 +4469,8 @@ static void malloc_consolidate(mstate av)
|
|
|
d8307d |
prevsize = prev_size (p);
|
|
|
d8307d |
size += prevsize;
|
|
|
d8307d |
p = chunk_at_offset(p, -((long) prevsize));
|
|
|
d8307d |
+ if (__glibc_unlikely (chunksize(p) != prevsize))
|
|
|
d8307d |
+ malloc_printerr ("corrupted size vs. prev_size in fastbins");
|
|
|
d8307d |
unlink(av, p, bck, fwd);
|
|
|
d8307d |
}
|
|
|
d8307d |
|