What is Buffer Overflow?
Occurs when a program writes more data to a buffer than it can hold. The overflowing data overwrites adjacent memory regions.
Stack-Based Overflows
Target the call stack. The return address (EIP/RIP) can be overwritten with attacker-controlled data.
void vulnerable(char *input) {
char buf[64];
strcpy(buf, input); // no bounds checking!
}Mitigations
ASLR, NX/DEP, and stack canaries are modern defenses. Use safe functions (strncpy, snprintf) and compiler protections.