diff options
Diffstat (limited to 'slides/2018-software-security/sample/assignment-buffer-overflow.c')
-rw-r--r-- | slides/2018-software-security/sample/assignment-buffer-overflow.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/slides/2018-software-security/sample/assignment-buffer-overflow.c b/slides/2018-software-security/sample/assignment-buffer-overflow.c new file mode 100644 index 0000000..2fb0d58 --- /dev/null +++ b/slides/2018-software-security/sample/assignment-buffer-overflow.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include <limits.h> +#define SECRET UINT_MAX + +void gotcha() { printf("Gotcha!\n"); } + +int main() { + unsigned secret = 0; + char buf[8]; + scanf("%s", buf); + if (secret == SECRET) { + gotcha(); + } + return 0; +} |