From 26d83ce45bf5418ceebaa99c0e09cea7efc7835b Mon Sep 17 00:00:00 2001 From: Omar Santos Date: Mon, 22 Feb 2021 13:21:15 -0500 Subject: [PATCH] Create strcpy_example.c --- buffer_overflow_example/strcpy_example.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 buffer_overflow_example/strcpy_example.c diff --git a/buffer_overflow_example/strcpy_example.c b/buffer_overflow_example/strcpy_example.c new file mode 100644 index 0000000..41fa0b9 --- /dev/null +++ b/buffer_overflow_example/strcpy_example.c @@ -0,0 +1,13 @@ +#include +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; +}