QP School
Buffer overflow in C - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32)
+--- Thread: Buffer overflow in C (/showthread.php?tid=5116)



Buffer overflow in C - Qomplainerz - 07-26-2023

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");