]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ctype: exclude control bytes from ISPRINT and ISGRAPH
authorAlhuda Khan <al.hudz.k@gmail.com>
Thu, 23 Jul 2026 06:39:04 +0000 (12:09 +0530)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 23 Jul 2026 20:25:06 +0000 (22:25 +0200)
Closes #22371

lib/curl_ctype.h
tests/unit/unit1307.c

index f3291ad8184b61f5e5247cadd628d59dc80ced6e..fd6b7d723cf5a8fbf9eabb1a8f66d0a6a4f5dd53 100644 (file)
 #define ISLOWCNTRL(x) ((unsigned char)(x) <= 0x1f)
 #define IS7F(x)       ((x) == 0x7f)
 
-#define ISLOWPRINT(x) (((x) >= 9) && ((x) <= 0x0d))
-
-#define ISPRINT(x)  (ISLOWPRINT(x) || (((x) >= ' ') && ((x) <= 0x7e)))
-#define ISGRAPH(x)  (ISLOWPRINT(x) || (((x) > ' ') && ((x) <= 0x7e)))
+#define ISPRINT(x)  (((x) >= ' ') && ((x) <= 0x7e))
+#define ISGRAPH(x)  (((x) > ' ') && ((x) <= 0x7e))
 #define ISCNTRL(x)  (ISLOWCNTRL(x) || IS7F(x))
 #define ISALPHA(x)  (ISLOWER(x) || ISUPPER(x))
 #define ISXDIGIT(x) (ISDIGIT(x) || ISLOWHEXALPHA(x) || ISUPHEXALPHA(x))
index 833319b611ec936f5ed2e15eda096bc026c6d148..c45dc81c770e1a482e0b2408c85b0735532f83ca 100644 (file)
@@ -174,10 +174,15 @@ static CURLcode test_unit1307(const char *arg)
     { "[[:print:]]",              "L",                      MATCH },
     { "[[:print:]]",              "\10",                    NOMATCH },
     { "[[:print:]]",              "\10",                    NOMATCH },
+    { "[[:print:]]",              "\t",                     NOMATCH },
+    { "[[:print:]]",              "\n",                     NOMATCH },
+    { "[[:print:]]",              "\r",                     NOMATCH },
     { "[[:space:]]",              " ",                      MATCH },
     { "[[:space:]]",              "x",                      NOMATCH },
     { "[[:graph:]]",              " ",                      NOMATCH },
     { "[[:graph:]]",              "x",                      MATCH },
+    { "[[:graph:]]",              "\t",                     NOMATCH },
+    { "[[:graph:]]",              "\r",                     NOMATCH },
     { "[[:blank:]]",              "\t",                     MATCH },
     { "[[:blank:]]",              " ",                      MATCH },
     { "[[:blank:]]",              "\r",                     NOMATCH },