]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Cast the argument to unsigned char when calling isspace()
authorMichael Baentsch <57787676+baentsch@users.noreply.github.com>
Thu, 8 Jun 2023 06:05:42 +0000 (08:05 +0200)
committerTomas Mraz <tomas@openssl.org>
Fri, 9 Jun 2023 15:30:28 +0000 (17:30 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21151)

apps/cmp.c
apps/lib/apps.c
apps/req.c
test/evp_test.c
test/testutil/provider.c

index 72acabcb6f8fc2eea1e080d6f98bf542803a185b..94ccde1a747b89119b60107c9e620d2ab79a8452 100644 (file)
@@ -2174,7 +2174,7 @@ static const char *prev_item(const char *opt, const char *end)
     beg = end;
     while (beg > opt) {
         --beg;
-        if (beg[0] == ',' || isspace(beg[0])) {
+        if (beg[0] == ',' || isspace(_UC(beg[0]))) {
             ++beg;
             break;
         }
@@ -2189,7 +2189,7 @@ static const char *prev_item(const char *opt, const char *end)
     opt_item[len] = '\0';
     while (beg > opt) {
         --beg;
-        if (beg[0] != ',' && !isspace(beg[0])) {
+        if (beg[0] != ',' && !isspace(_UC(beg[0]))) {
             ++beg;
             break;
         }
index b8beef055621df611f554426e3a87a2a3eae7e49..c9b509525cfef412ecb76bcc88949191b3654467 100644 (file)
@@ -690,13 +690,13 @@ void *app_malloc(size_t sz, const char *what)
 char *next_item(char *opt) /* in list separated by comma and/or space */
 {
     /* advance to separator (comma or whitespace), if any */
-    while (*opt != ',' && !isspace(*opt) && *opt != '\0')
+    while (*opt != ',' && !isspace(_UC(*opt)) && *opt != '\0')
         opt++;
     if (*opt != '\0') {
         /* terminate current item */
         *opt++ = '\0';
         /* skip over any whitespace after separator */
-        while (isspace(*opt))
+        while (isspace(_UC(*opt)))
             opt++;
     }
     return *opt == '\0' ? NULL : opt; /* NULL indicates end of input */
index 59ed6ebaa2e52d8d65d7d89df87ce21a26e705cb..711bdff8bfe159b0547309cbfecf9be2b6604bd8 100644 (file)
@@ -198,7 +198,7 @@ static int duplicated(LHASH_OF(OPENSSL_STRING) *addexts, char *kv)
 
     /* Check syntax. */
     /* Skip leading whitespace, make a copy. */
-    while (isspace(*kv))
+    while (isspace(_UC(*kv)))
         kv++;
     if ((p = strchr(kv, '=')) == NULL) {
         BIO_printf(bio_err, "Parse error on -addext: missing '='\n");
@@ -210,7 +210,7 @@ static int duplicated(LHASH_OF(OPENSSL_STRING) *addexts, char *kv)
 
     /* Skip trailing space before the equal sign. */
     for (p = kv + off; p > kv; --p)
-        if (!isspace(p[-1]))
+        if (!isspace(_UC(p[-1])))
             break;
     if (p == kv) {
         BIO_printf(bio_err, "Parse error on -addext: missing key\n");
index b783ab7ddfd2a98a09122eebdb9d6d2742c4cc62..19efa9590169d7d4637d9f5849a98e17a663390c 100644 (file)
@@ -3811,11 +3811,11 @@ static int prov_available(char *providers)
     int more = 1;
 
     while (more) {
-        for (; isspace(*providers); providers++)
+        for (; isspace((unsigned char)(*providers)); providers++)
             continue;
         if (*providers == '\0')
             break;               /* End of the road */
-        for (p = providers; *p != '\0' && !isspace(*p); p++)
+        for (p = providers; *p != '\0' && !isspace((unsigned char)(*p)); p++)
             continue;
         if (*p == '\0')
             more = 0;
index a40a72c929e12ae11454ed141af64825eab50b42..30c757c5c1d3f33cc93204ce25b5dfb25f79cd81 100644 (file)
@@ -177,11 +177,11 @@ int fips_provider_version_match(OSSL_LIB_CTX *libctx, const char *versions)
     } mode;
 
     while (*versions != '\0') {
-        for (; isspace(*versions); versions++)
+        for (; isspace((unsigned char)(*versions)); versions++)
             continue;
         if (*versions == '\0')
             break;
-        for (p = versions; *versions != '\0' && !isspace(*versions); versions++)
+        for (p = versions; *versions != '\0' && !isspace((unsigned char)(*versions)); versions++)
             continue;
         if (*p == '!') {
             mode = MODE_NE;