diff --git a/test/simple-memory-corruption/eight_byte_overflow_large.c b/test/simple-memory-corruption/eight_byte_overflow_large.c index 3b8c8d3..d6b7544 100644 --- a/test/simple-memory-corruption/eight_byte_overflow_large.c +++ b/test/simple-memory-corruption/eight_byte_overflow_large.c @@ -7,7 +7,8 @@ OPTNONE int main(void) { if (!p) { return 1; } - *(p + 256 * 1024 + 7) = 0; + size_t size = malloc_usable_size(p); + *(p + size + 7) = 0; free(p); return 0; } diff --git a/test/simple-memory-corruption/eight_byte_overflow_small.c b/test/simple-memory-corruption/eight_byte_overflow_small.c index bd2666d..54c0de2 100644 --- a/test/simple-memory-corruption/eight_byte_overflow_small.c +++ b/test/simple-memory-corruption/eight_byte_overflow_small.c @@ -7,7 +7,8 @@ OPTNONE int main(void) { if (!p) { return 1; } - *(p + 8 + 7) ^= 1; + size_t size = malloc_usable_size(p); + *(p + size + 7) ^= 1; free(p); return 0; }