commit af3bb68add1c40d19d0dee382009e21b0870a38f
Author:     NRK <n...@disroot.org>
AuthorDate: Fri Mar 18 16:20:54 2022 +0600
Commit:     Hiltjo Posthuma <hil...@codemadness.org>
CommitDate: Fri Mar 18 12:11:27 2022 +0100

    avoid potential UB when using isprint()
    
    all the ctype.h functions' argument must be representable as an unsigned
    char or as EOF, otherwise the behavior is undefined.

diff --git a/st.c b/st.c
index c71fa06..1307fdf 100644
--- a/st.c
+++ b/st.c
@@ -367,7 +367,7 @@ static const char base64_digits[] = {
 char
 base64dec_getc(const char **src)
 {
-       while (**src && !isprint(**src))
+       while (**src && !isprint((unsigned char)**src))
                (*src)++;
        return **src ? *((*src)++) : '=';  /* emulate padding if string ends */
 }

Reply via email to