From 75c293f37df7e12b6fbc8fdcbdc21092de44dd66 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 26 Nov 2021 10:28:18 +0100 Subject: [PATCH] test-sizeof: show stack and heap randomization It's useful to reassure yourself those those things actually work ;) --- src/test/test-sizeof.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c index e86844b8ce0..f349852553d 100644 --- a/src/test/test-sizeof.c +++ b/src/test/test-sizeof.c @@ -93,5 +93,13 @@ int main(void) { printf("timeval: %zu\n", sizeof(struct timeval)); printf("timespec: %zu\n", sizeof(struct timespec)); + + void *x = malloc(100); + + printf("local variable: %p\n", &function_pointer); + printf("glibc function: %p\n", memcpy); + printf("heap allocation: %p\n", x); + free(x); + return 0; } -- 2.47.3