diff options
author | toni <matzeton@googlemail.com> | 2013-03-05 13:31:55 +0100 |
---|---|---|
committer | toni <matzeton@googlemail.com> | 2013-03-05 13:31:55 +0100 |
commit | 664c8f1794db0c1f4ebafab955baaba04fc35ec2 (patch) | |
tree | 73f702ba64676dac111069c2c94bc195b956616a | |
parent | 8470dfca39fca5c5c72ea368fcdce6a445305a14 (diff) |
Makefile: make test
overflow.c: commented out the vulnerable function
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | Makefile | 12 | ||||
-rw-r--r-- | overflow.c | 8 |
3 files changed, 15 insertions, 6 deletions
@@ -1,3 +1,2 @@ /exploit /overflow -/.project @@ -10,6 +10,16 @@ overflow: @echo 'building overflow' gcc -Wall -m32 -mpreferred-stack-boundary=2 -g -fno-stack-protector overflow.c -o overflow +test: overflow + @if [ -x /usr/bin/python ]; then \ + ./overflow `python -c 'print "A"*5000'`; \ + else \ + echo 'Missing PYTHON; not testing'; \ + fi + @echo 'TEST FAILED: ./overflow not segfaulting' + clean: - -$(RM) overflow exploit + -$(RM) -f overflow exploit -@echo ' ' + +.PHONY: all clean @@ -10,7 +10,7 @@ #include <string.h> #define ENV_VAR "EXPLOIT" -#define BUFLEN 2 +#define BUFLEN 10 char buf[BUFLEN]; char *env; @@ -22,14 +22,14 @@ main(int argc, char **argv) if (argc > 1) { fprintf(stderr, "arg0: %s\n", argv[1]); - + /* possible stack overflow via command line */ strcpy(buf, argv[1]); } else if ((env = getenv(ENV_VAR))) { fprintf(stderr, "env_var: "ENV_VAR"\n"); fprintf(stderr, "env: %s\n", env); - + /* possible stack overflow via enviroment variable */ strcpy(buf, env); } else @@ -38,7 +38,7 @@ main(int argc, char **argv) return(1); } - printf("buf: %p\n", buf); + printf("*buf: %p\n", buf); return (0); } |