QP School

Full Version: Buffer overflow in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Writing more data into an array than it can hold can cause memory corruption and security vulnerabilities.

// Incorrect
char name[5];
strcpy(name, "John Doe"); // Buffer overflow

// Correct
char name[50];
strcpy(name, "John Doe");