Stack Layout During a Buffer Overflow
The stack grows down (high addresses on top). A write that runs off the end of buffer[16] climbs up toward the return address. Hover any cell for its role and the defense that stops it.
Normal stack contents
Attacker-controlled bytes
Annotation
Other frames (greyed)
When the function returns, the CPU pops the corrupted return address and jumps to attacker-controlled memory.