commit df4c0611366bf361fa263fbc57009cbe68456855
Author: Hiltjo Posthuma <[email protected]>
AuthorDate: Thu May 6 01:04:35 2021 +0200
Commit: Hiltjo Posthuma <[email protected]>
CommitDate: Thu May 6 01:04:35 2021 +0200
fix an out-of-bounds read if the input is ""
Notified by Guilherme Janczak <[email protected]>, thanks!
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';
}