From df4c0611366bf361fa263fbc57009cbe68456855 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Thu, 6 May 2021 01:04:35 +0200 Subject: [PATCH] fix an out-of-bounds read if the input is "" Notified by Guilherme Janczak , thanks! --- util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.c b/util.c index bdba718..2567812 100644 --- a/util.c +++ b/util.c @@ -61,7 +61,7 @@ trim(char *s) { char *e; e = s + strlen(s) - 1; - while(isspace(*e) && e > s) + while(e > s && isspace(*e)) e--; *(e + 1) = '\0'; } -- 2.39.2