From 43dce73c81b60db010d1cd1768af60cbcaeacd1a Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Thu, 15 Dec 2022 13:08:16 -0500 Subject: [PATCH] CHECK YOUR INPUT IDIOT --- msh.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/msh.c b/msh.c index 590a655..fe66427 100644 --- a/msh.c +++ b/msh.c @@ -318,7 +318,9 @@ int mathTest() { #endif printf("%d %c %d = ", num1, mathOperation[randProblem], num2); numLine = readline(""); - sscanf(numLine, "%ld", &numAnswer); + if (numLine != NULL && strlen(numLine) > 0) { + sscanf(numLine, "%ld", &numAnswer); + } if (numSolution != numAnswer) { // If wrong answer status = 1;