gets
Prototype
char* gets(char* s);Vulnerable example
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
char buffer[16]; // create a buffer with 16 bytes of storage
printf("Enter a string: ");
gets(buffer); // read input from the user and store it in buffer
printf("You entered: %s\n", buffer); // print the contents of buffer
return 0;
}Prevent
Last updated