Example of unsafe program for Stack Frames
Stack frame description
Stack: the space where call records and parameters must be recorded when the C language program is running.
Save item:
Function tuning framework
Parameter transfer
Save returned values
Provide local variables
The story of an old driver driving by changing the stack frame
# Include <stdio. h> # include <stdlib. h> # include <string. h> # include <errno. h> void Exit () {printf ("I am a big bug, old driver \ n "); /// the old driver calls the shell command to drive a car. // there are many things that can be done here, such as // reading user privacy files and sending them over the network. // Modify the system, configure the system, delete files, and so on. system ("sl"); exit (10010);} void func (int x, int y) {int * p = & x; -- p; printf ("int Func \ n"); // The core action is here, by modifying the position where the returned value is saved in the stack frame, so that the function does not return normally, but enters the working position of the old driver. * P = Exit;} int main () {func (a, B); // The program is not running here printf ("after func () \ n "); return 0 ;}