07-26-2023, 07:08 AM
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");
// Incorrect
char name[5];
strcpy(name, "John Doe"); // Buffer overflow
// Correct
char name[50];
strcpy(name, "John Doe");
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos