mirror of
https://github.com/The-Art-of-Hacking/h4cker
synced 2024-11-25 04:10:17 +00:00
Create strcpy_example.c
This commit is contained in:
parent
e73058f7d3
commit
26d83ce45b
1 changed files with 13 additions and 0 deletions
13
buffer_overflow_example/strcpy_example.c
Normal file
13
buffer_overflow_example/strcpy_example.c
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue