]> git.armaanb.net Git - sic.git/blobdiff - util.c
fix an out-of-bounds read if the input is ""
[sic.git] / util.c
diff --git a/util.c b/util.c
index bdba7188b246412d158398b30e6a829c5442940f..25678120422eea5ec0782e9040fdd5ad24b9ff45 100644 (file)
--- 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';
 }