summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2022-03-18 16:20:54 +0600
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-05-08 00:44:22 +0200
commit022b9877c33dcf670ee48f56157c409c09c85a3d (patch)
tree97a5c29b5cefd95d393a332fcb5b2d94fd6ac1ca
parent086f40baa111d79d45f5ea50d52206a2b9246cc1 (diff)
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.
-rw-r--r--st.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/st.c b/st.c
index 29b7462..7b755eb 100644
--- a/st.c
+++ b/st.c
@@ -377,7 +377,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 */
}