From d12fc89895cfd824ff806c21103180baa293a7c2 Mon Sep 17 00:00:00 2001
From: Arman Arethna <aarethna@syudent.unimelb.edu.au>
Date: Tue, 20 Oct 2020 00:25:14 +0530
Subject: [PATCH] vuln-5 divide with only one item on stack tries to access
 item at array index undefined

---
 poc/vuln-5.poc  | 2 ++
 src/vuln-5/dc.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/poc/vuln-5.poc b/poc/vuln-5.poc
index e69de29..5d3e6d7 100644
--- a/poc/vuln-5.poc
+++ b/poc/vuln-5.poc
@@ -0,0 +1,2 @@
+push 10
+/
\ No newline at end of file
diff --git a/src/vuln-5/dc.c b/src/vuln-5/dc.c
index 1a47cd0..d0d6278 100644
--- a/src/vuln-5/dc.c
+++ b/src/vuln-5/dc.c
@@ -518,7 +518,7 @@ static int execute(void){
       return -1;
     }
     
-    if (stack_size() < 2){
+    if (stack_size() < 1){
       debug_printf("Add from insufficient stack\n");
       return -1;
     }
-- 
GitLab