Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Buffer overflow in C
#1
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");
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Overflow and underflow with short int in C Qomplainerz 0 395 07-26-2023, 03:48 PM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 2 Guest(s)