Created
November 15, 2012 03:35
-
-
Save maxdeliso/4076495 to your computer and use it in GitHub Desktop.
exploitable
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
CFLAGS=-g | |
SS=stackSmash | |
CC=clang -v | |
$(SS): $(SS).o | |
$(CC) $(CFLAGS) $(SS).o -o $(SS) | |
objdump -xtd ./$(SS) > $(SS).asm | |
.c.o: | |
$(CC) -c $< | |
clean: | |
rm -f $(SS) $(SS).o $(SS).asm |
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> | |
#include <stdlib.h> | |
void greet() { | |
char nameBuf[8]; | |
printf("hello, what is your name: "); | |
gets(nameBuf); | |
printf("hi, %s\n", nameBuf); | |
} | |
int main() { | |
int local; | |
printf("%-8s@:%08x\n%-8s@:%08x\n%-8s@:%08x\n", | |
"main", (unsigned int) main, | |
"greet", (unsigned int) greet, | |
"local", (unsigned int) &local); | |
greet(); | |
printf("bye\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment