fix an out-of-bounds read if the input is "" - sic - simple irc client | |
git clone git://git.suckless.org/sic | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit df4c0611366bf361fa263fbc57009cbe68456855 | |
parent ec293427a0cc2ef7f561a60347ce940d567efb72 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Thu, 6 May 2021 01:04:35 +0200 | |
fix an out-of-bounds read if the input is "" | |
Notified by Guilherme Janczak <[email protected]>, thanks! | |
Diffstat: | |
M util.c | 2 +- | |
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'; | |
} |