cyber-security-resources/buffer_overflow_example/strcpy_example.c

14 lines
259 B
C
Raw Permalink Normal View History

2021-02-22 13:21:15 -05:00
#include <string.h>
void omarsucks(char *str)
{
char buffer[12];
/* The following strcpy will result in buffer overflow */
strcpy(buffer, str);
}
int main()
{
char *str = "This text is indeed a lot bigger or longer than 12";
omarsucks(str);
return 1;
}