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.

ref. https://git.suckless.org/st/commit/af3bb68add1c40d19d0dee382009e21b0870a38f.html
This commit is contained in:
bakkeby 2022-03-28 11:21:42 +02:00
parent fb0b76b0ff
commit addd5e9749

2
st.c
View File

@ -397,7 +397,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 */
}