Added stack address randomization example.
[C-Programming-Examples.git] / stack_address.c
blob05aa0fda6b5722f6b9668fa08fb0ee3188b8dc6d
1 /*
2 Program illustrates stack randomization of operating systems.
4 Operating systems attempt to prevent security vulnerability by
5 randomizing the stack location when a program starts.
7 This helps prevent buffer overflow attacks.
9 To test and see if this security measure is built into your
10 system, run this program several times; if the stack address
11 changes each time, it is likely that this is implemented on
12 your system.
15 #include <stdio.h>
17 int main()
19 int local;
20 printf("local at %p\n", &local);
21 return 0;