fix an out-of-bounds read if the input is ""

Notified by Guilherme Janczak <guilherme.janczak@yandex.com>, thanks!
This commit is contained in:
Hiltjo Posthuma 2021-05-06 01:04:35 +02:00
parent ec293427a0
commit df4c061136
1 changed files with 1 additions and 1 deletions

2
util.c
View File

@ -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';
}