Created
August 7, 2026 03:25
-
-
Save Muaath5/5fc1b1dcb15907d01ab52cba926e43d1 to your computer and use it in GitHub Desktop.
Buffer Overflow Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| void greet() { | |
| char name[16]; | |
| scanf("%s", name); | |
| printf("Hello %s!\n", name); | |
| } | |
| void secret() { | |
| printf("Hacked!\n"); | |
| } | |
| void main() { | |
| greet(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 | |
| gcc -O0 -fno-stack-protector -no-pie test.c -o test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AAAAAAAAAAAAAAAABBBBBBB�@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment