From 6b9b7275e5d4572560ea35b335d84633c1525ea4 Mon Sep 17 00:00:00 2001 From: Lewis Van Winkle Date: Sun, 23 May 2021 18:31:24 -0500 Subject: [PATCH] fix for possible out-of-bounds memory access in repl --- repl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/repl.c b/repl.c index 021a696..5772883 100644 --- a/repl.c +++ b/repl.c @@ -19,6 +19,10 @@ static char *readline(const char *prompt) { } size_t len = strlen(line); + + if (len < 1) + return NULL; + if (line[len - 1] == '\n') { line[len - 1] = '\0'; len -= 1;