From d6a8d83d76df0675e518f81ba716ecf81791bd6c Mon Sep 17 00:00:00 2001 From: RuixiangJiang <2037358823@qq.com> Date: Sat, 28 Oct 2023 22:04:01 +0800 Subject: [PATCH] upd test4 --- phase1/Makefile | 1 + phase1/extratest/test4.out | 3 +++ phase1/extratest/test4.spl | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 phase1/extratest/test4.out create mode 100644 phase1/extratest/test4.spl diff --git a/phase1/Makefile b/phase1/Makefile index 7579fea..8fb5df2 100644 --- a/phase1/Makefile +++ b/phase1/Makefile @@ -17,6 +17,7 @@ lexer: syntax.tab.* lex.yy.c # For debugging lex.l .PHONY: test clean test: splc + @bin/splc extratest/test4.spl > extratest/test4.out @bin/splc extratest/test1.spl > extratest/test1.myout diff extratest/test1.out extratest/test1.myout @bin/splc extratest/test2.spl > extratest/test2.myout diff --git a/phase1/extratest/test4.out b/phase1/extratest/test4.out new file mode 100644 index 0000000..b5382dd --- /dev/null +++ b/phase1/extratest/test4.out @@ -0,0 +1,3 @@ +INCLUDE (1) + stdio.h +Program (1) diff --git a/phase1/extratest/test4.spl b/phase1/extratest/test4.spl new file mode 100644 index 0000000..ab8737a --- /dev/null +++ b/phase1/extratest/test4.spl @@ -0,0 +1,19 @@ +#include + +/* +Please disable ASLR by sudo sysctl -w kernel.randomize_va_space=0 +*/ + +void win() { // at 0x08048456 + puts("Excellent, now let's go hack the world"); +} +void vuln() { + char buf[16]; + scanf("%s", buf); +} +int main() { + puts("Welcome back to 2023 CS315, let's have some fun!"); + vuln(); + puts("Have a good day, Bye~"); + return 0; +} \ No newline at end of file