mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-06-26 14:42:27 +00:00
12 lines
240 B
C
12 lines
240 B
C
|
#include <stdbool.h>
|
||
|
#include <malloc.h>
|
||
|
|
||
|
size_t malloc_object_size(void *ptr);
|
||
|
|
||
|
__attribute__((optimize(0)))
|
||
|
int main(void) {
|
||
|
char *p = malloc(16);
|
||
|
size_t size = malloc_object_size(p);
|
||
|
return size != (SLAB_CANARY ? 24 : 32);
|
||
|
}
|