This commit is contained in:
Ward Wouts 2020-01-16 08:42:45 +01:00
commit 55dd6701c6
10 changed files with 485 additions and 0 deletions

9
code/Makefile Normal file
View file

@ -0,0 +1,9 @@
.PHONY: all
demo:
gcc -ggdb -fno-stack-protector -z execstack -z norelro -m32 -no-pie -mpreferred-stack-boundary=2 demo.c -o demo
diy:
gcc -ggdb -fno-stack-protector -z execstack -z norelro -m32 -no-pie -mpreferred-stack-boundary=2 diy.c -o diy
all: demo diy

BIN
code/demo Executable file

Binary file not shown.

16
code/demo.c Normal file
View file

@ -0,0 +1,16 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char * argv[]){
char buf[128];
if(argc == 1){
printf("Usage: %s argument\n", argv[0]);
exit(1);
}
strcpy(buf,argv[1]);
printf("%s", buf);
return 0;
}

BIN
code/diy Executable file

Binary file not shown.

22
code/diy.c Normal file
View file

@ -0,0 +1,22 @@
#include <stdio.h>
#include <strings.h>
void winner()
{
printf("You win\n");
}
void whoareyou()
{
char name[250];
printf("What's your name? ");
gets(name);
printf("\nHello, %s\n", name);
}
int main()
{
whoareyou();
printf("You lose\n");
}

BIN
code/narnia2 Executable file

Binary file not shown.