summaryrefslogtreecommitdiff
path: root/libexec/ld.so
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2021-04-19 06:43:16 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2021-04-19 06:43:16 +0000
commit2b40a6bcd46d55362efcfd4d2267e3d67067306a (patch)
tree9606d0bc7d10cce80590a6eb0f94f75c6c9f42e6 /libexec/ld.so
parent9dcf06442d37ef54db36258d57b85998c01cc273 (diff)
Same internal consistency check as libc malloc: size in hash table
should correspond to size of chunk meta data
Diffstat (limited to 'libexec/ld.so')
-rw-r--r--libexec/ld.so/malloc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libexec/ld.so/malloc.c b/libexec/ld.so/malloc.c
index 3dba1283fd2..c5eae02e8f6 100644
--- a/libexec/ld.so/malloc.c
+++ b/libexec/ld.so/malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.c,v 1.31 2020/12/26 13:17:33 otto Exp $ */
+/* $OpenBSD: malloc.c,v 1.32 2021/04/19 06:43:15 otto Exp $ */
/*
* Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -950,7 +950,10 @@ ofree(void *p)
} else {
void *tmp;
int i;
+ struct chunk_info *info = (struct chunk_info *)r->size;
+ if (info->size != sz)
+ wrterror("internal struct corrupt");
find_chunknum(g_pool, r, p, CHUNK_CANARIES);
for (i = 0; i <= MALLOC_DELAYED_CHUNK_MASK; i++) {
if (p == g_pool->delayed_chunks[i])