[hackers] [st][PATCH] avoid potential UB when using isprint()

From: NRK <nrk_AT_disroot.org>
Date: Fri, 18 Mar 2022 16:20:54 +0600

all the ctype.h functions' argument must be representable as an unsigned
char or as EOF, otherwise the behavior is undefined.
---
 st.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/st.c b/st.c
index c71fa06..1307fdf 100644
--- a/st.c
+++ b/st.c
_AT_@ -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 */
 }
-- 
2.34.1
Received on Fri Mar 18 2022 - 11:20:54 CET

This archive was generated by hypermail 2.3.0 : Fri Mar 18 2022 - 11:24:36 CET