Create strcpy_example.c

This commit is contained in:
Omar Santos 2021-02-22 13:21:15 -05:00 committed by GitHub
parent e73058f7d3
commit 26d83ce45b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,13 @@
#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;
}