diff --git a/Makefile b/Makefile index d3e3138..5887923 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CONFIG_CXX_ALLOCATOR := true CONFIG_UBSAN := false CPPFLAGS := -D_GNU_SOURCE -SHARED_FLAGS := -O2 -flto -fPIC -fvisibility=hidden -fno-plt -pipe -Wall -Wextra +SHARED_FLAGS := -O2 -flto -fPIC -fvisibility=hidden -fno-plt -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings CFLAGS := -std=c11 $(SHARED_FLAGS) -Wmissing-prototypes CXXFLAGS := -std=c++14 $(SHARED_FLAGS) LDFLAGS := -Wl,-z,defs,-z,relro,-z,now,-z,nodlopen,-z,text diff --git a/malloc.c b/malloc.c index 0152977..261a044 100644 --- a/malloc.c +++ b/malloc.c @@ -296,13 +296,13 @@ static void *slot_pointer(size_t size, void *slab, size_t slot) { return (char *)slab + slot * size; } -static void write_after_free_check(const char *p, size_t size) { +static void write_after_free_check(const void *p, size_t size) { if (!WRITE_AFTER_FREE_CHECK) { return; } for (size_t i = 0; i < size; i += sizeof(u64)) { - if (*(u64 *)(p + i)) { + if (*(const u64 *)(p + i)) { fatal_error("detected write after free"); } }