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.
This commit is contained in:
NRK 2022-03-18 16:20:54 +06:00 committed by Sergey Silaev
parent d47bd177a6
commit a93990b139

2
st.c
View file

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