Lesson:
Buffer Overflows
Public previewWant everyone on your software team to learn this? Get completion tracking and compliance reporting with Hacksplaining for Teams. Free 14-day trial.
Train my teamoops.cvoid askForUsername()
{
// Buffer can only hold 8 characters!
char buffer[8];
printf("Enter your username:\n");
scanf("%s", buffer);
printf("You entered: %s\n", buffer);
}
int main()
{
while(1) askForUsername();
return 0;
}Running: "oops.c" Enter your username: