From: Zbigniew Jędrzejewski-Szmek Date: Fri, 26 Nov 2021 09:28:18 +0000 (+0100) Subject: test-sizeof: show stack and heap randomization X-Git-Tag: v250-rc1~103^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75c293f37df7e12b6fbc8fdcbdc21092de44dd66;p=thirdparty%2Fsystemd.git test-sizeof: show stack and heap randomization It's useful to reassure yourself those those things actually work ;) --- 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; }