From e30425e27ab5ed71eb01ec59e316439aed3ba795 Mon Sep 17 00:00:00 2001
From: ryuzakighost <ryuzakighost@gmail.com>
Date: Sat, 13 Oct 2018 14:18:48 +1100
Subject: [PATCH] test
---
fuzzer/Fuzzer.java | 7 +++++--
src/machine-vuln1.c | 8 ++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/fuzzer/Fuzzer.java b/fuzzer/Fuzzer.java
index 498dc60..1b71818 100644
--- a/fuzzer/Fuzzer.java
+++ b/fuzzer/Fuzzer.java
@@ -27,9 +27,12 @@ public class Fuzzer {
for(int x=0;x<300;x++){
pw.println("ADD R1 R1 R2");
}*/
- pw.println("MOV R1 65535");
+ /*pw.println("MOV R1 65535");
pw.println("LDR R0 R1 0");
- pw.println("RET R0");
+ pw.println("RET R0");*/
+ pw.print("RET R0");
+ for(int x=0;x<2000;x++);
+ pw.print("a");
/*pw.println("ADD R0 R1 R2");
diff --git a/src/machine-vuln1.c b/src/machine-vuln1.c
index 4d3cae3..aada30d 100644
--- a/src/machine-vuln1.c
+++ b/src/machine-vuln1.c
@@ -59,7 +59,7 @@ static void machine_init(void){
regs = malloc(sizeof(int32_t)*NUM_REGS);
/* memset can be vulnerable - changes to this can result in dirty memory to be read*/
- memset(memory,0,sizeof(int32_t)*(MEMORY_SIZE-2));
+ memset(memory,0,sizeof(int32_t)*(MEMORY_SIZE));
memset(regs,0,sizeof(int32_t)*NUM_REGS);
count = 0;
}
@@ -452,14 +452,14 @@ static int read_program(const char *filename){
return -1;
}
}
- if (program[instructionCount][MAX_LINE_LENGTH] != '\0'){
+ /*if (program[instructionCount][MAX_LINE_LENGTH] != '\0'){
if (!(program[instructionCount][MAX_LINE_LENGTH] == '\n' && program[instructionCount][MAX_LINE_LENGTH+1] == '\0')){
debug_printf("Line %d exceeds maximum length (%d)\n",instructionCount+1,MAX_LINE_LENGTH);
debug_printf("(Expected at array index %d to find NUL but found '%c' (%d))\n",MAX_LINE_LENGTH,program[instructionCount][MAX_LINE_LENGTH],program[instructionCount][MAX_LINE_LENGTH]);
fclose(f);
return -1;
}
- }else{
+ }else{*/
/* program[instructionCount][MAX_LINE_LENGTH] == '\0', so
strlen is guaranteed to be <= MAX_LINE_LENGTH
Check if it has a newline and add it if it needs it */
@@ -470,7 +470,7 @@ static int read_program(const char *filename){
program[instructionCount][len+1] = '\0';
}
}
- }
+ /*}*/
instructionCount++;
}
--
GitLab