commit df4c0611366bf361fa263fbc57009cbe68456855
parent ec293427a0cc2ef7f561a60347ce940d567efb72
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 6 May 2021 01:04:35 +0200
fix an out-of-bounds read if the input is ""
Notified by Guilherme Janczak <guilherme.janczak@yandex.com>, thanks!
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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';
}