Skip to content

Instantly share code, notes, and snippets.

@maxdeliso
Created November 15, 2012 03:35
Show Gist options
  • Save maxdeliso/4076495 to your computer and use it in GitHub Desktop.
Save maxdeliso/4076495 to your computer and use it in GitHub Desktop.
exploitable
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
#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