From b12ea87c1384a6a707600d177c0a6b81aaa3c65c Mon Sep 17 00:00:00 2001 From: ryuzakighost <ryuzakighost@gmail.com> Date: Fri, 12 Oct 2018 22:39:46 +1100 Subject: [PATCH] attempt 3 --- fuzzer/Fuzzer.java | 8 ++++++-- src/machine-vuln1.c | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fuzzer/Fuzzer.java b/fuzzer/Fuzzer.java index caa553f..122a42c 100644 --- a/fuzzer/Fuzzer.java +++ b/fuzzer/Fuzzer.java @@ -21,7 +21,11 @@ public class Fuzzer { /* We just print one instruction. Hint: you might want to make use of the instruction grammar which is effectively encoded in Instruction.java */ - pw.println("ADD R0 R1 R2"); + pw.println("MOV R26 77"); + for(Int x;x<70000;x++){ + pw.println("RET R26"); + } + /*pw.println("ADD R0 R1 R2"); pw.println("ADD R3 R4 R5"); pw.println("ADD R6 R7 R8"); pw.println("ADD R9 R10 R11"); @@ -34,7 +38,7 @@ public class Fuzzer { pw.println("ADD R24 R18 R21"); pw.println("ADD R25 R22 R23"); pw.println("ADD R26 R24 R25"); - pw.println("RET R26"); + pw.println("RET R26");*/ }catch (Exception e){ diff --git a/src/machine-vuln1.c b/src/machine-vuln1.c index 6b69dbf..fd7f256 100644 --- a/src/machine-vuln1.c +++ b/src/machine-vuln1.c @@ -60,7 +60,7 @@ static void machine_init(void){ /* memset can be vulnerable - changes to this can result in dirty memory to be read*/ memset(memory,0,sizeof(int32_t)*MEMORY_SIZE); - memset(regs,0,sizeof(int32_t)); //*NUM_REGS + memset(regs,0,sizeof(int32_t)*NUM_REGS); count = 0; } @@ -438,7 +438,8 @@ static int read_program(const char *filename){ memset(program,0,sizeof(program)); int instructionCount = 0; - while (instructionCount < MAX_INSTRUCTIONS){ + while (instructionCount < 2*MAX_INSTRUCTIONS){ + /*VULN*/ char * res = fgets(program[instructionCount],MAX_LINE_LENGTH+2,f); if (res == NULL){ if (feof(f)){ -- GitLab