2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Fix the real allocation size in OpenBSD rallocx shim

In the rallocx() shim for OpenBSD (that's the only platform that doesn't
have malloc_size() or malloc_usable_size() equivalent), the newly
allocated size was missing the extra size_t member for storing the
allocation size leading to size_t sized overflow at the end of the
reallocated memory chunk.
This commit is contained in:
Ondřej Surý
2021-07-12 08:43:14 +02:00
parent 592a4bc456
commit d1a9e549b1

View File

@@ -106,7 +106,7 @@ static inline void *
rallocx(void *ptr, size_t size, int flags) {
UNUSED(flags);
size_t *__ptr = realloc(&((size_t *)ptr)[-1], size);
size_t *__ptr = realloc(&((size_t *)ptr)[-1], size + sizeof(size_t));
REQUIRE(__ptr != NULL);
__ptr[0] = size;