mirror of
https://github.com/The-Art-of-Hacking/h4cker.git
synced 2024-12-18 19:06:08 +00:00
Create strcpy_example.c
This commit is contained in:
parent
e73058f7d3
commit
26d83ce45b
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 New Issue
Block a user