WCU / Cybersecurity
~/CSC 472/Class 03/KP 03
Class 03 · KP 03 / 17

What Is a Buffer Overflow?

higher addressessaved return addresshijack targetsaved RBPchar buffer[ ]local variablelower addresses (RSP)overflowwrites up
A stack frame: overflowing the buffer overwrites the saved return address.
  • A buffer is a fixed-size region of memory, e.g. char buf[64];.
  • An overflow happens when a program writes past the end of that buffer.
  • The extra bytes land on adjacent memory — other variables, saved registers, the return address.

Root cause: an unbounded copy — the amount written is driven by the input, not by the buffer size.

Key Takeaway

Overflow = data size is controlled by the attacker, but the destination size is fixed and smaller.