]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Cast the argument to unsigned char when calling isdigit()
authorMichael Baentsch <57787676+baentsch@users.noreply.github.com>
Mon, 5 Jun 2023 11:09:29 +0000 (13:09 +0200)
committerTomas Mraz <tomas@openssl.org>
Tue, 6 Jun 2023 13:50:37 +0000 (15:50 +0200)
Fixes #21123

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21127)

(cherry picked from commit 8229874476cc2955e6947cf6d3fee09e13b8c160)

apps/s_client.c
crypto/LPdir_unix.c
engines/e_loader_attic.c
providers/implementations/storemgmt/file_store.c
test/testutil/provider.c

index f056adb68e99cc90c061ae92c12ed8e035d7197f..d82b02d1929b33022bfc9c259d29cd62abcd7f7d 100644 (file)
@@ -2272,7 +2272,7 @@ int s_client_main(int argc, char **argv)
             do {
                 mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ);
             }
-            while (mbuf_len > 3 && (!isdigit(mbuf[0]) || !isdigit(mbuf[1]) || !isdigit(mbuf[2]) || mbuf[3] != ' '));
+            while (mbuf_len > 3 && (!isdigit((unsigned char)mbuf[0]) || !isdigit((unsigned char)mbuf[1]) || !isdigit((unsigned char)mbuf[2]) || mbuf[3] != ' '));
             (void)BIO_flush(fbio);
             BIO_pop(fbio);
             BIO_free(fbio);
index bc0e924e46a741be5ffb3c76dac23d9009986c64..aa266c5979298291be4595f55a8792c19002858d 100644 (file)
@@ -137,7 +137,7 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
     if ((*ctx)->expect_file_generations) {
         char *p = (*ctx)->entry_name + strlen((*ctx)->entry_name);
 
-        while(p > (*ctx)->entry_name && isdigit(p[-1]))
+        while (p > (*ctx)->entry_name && isdigit((unsigned char)p[-1]))
             p--;
         if (p > (*ctx)->entry_name && p[-1] == ';')
             p[-1] = '\0';
index 87056c4de17496a6072f48ba89209325dfc7bc21..6a1df9b23cb62470034d565016ee2acece946b8b 100644 (file)
@@ -1486,9 +1486,9 @@ static int file_name_check(OSSL_STORE_LOADER_CTX *ctx, const char *name)
      * Last, check that the rest of the extension is a decimal number, at
      * least one digit long.
      */
-    if (!isdigit(*p))
+    if (!isdigit((unsigned char)*p))
         return 0;
-    while (isdigit(*p))
+    while (isdigit((unsigned char)*p))
         p++;
 
 #ifdef __VMS
index 6d6312659beac1df4d240a9c3464b961599b3449..b5bb1dc92a02ff9e8c97e56cc1a09e3dfdb74486 100644 (file)
@@ -612,9 +612,9 @@ static int file_name_check(struct file_ctx_st *ctx, const char *name)
      * Last, check that the rest of the extension is a decimal number, at
      * least one digit long.
      */
-    if (!isdigit(*p))
+    if (!isdigit((unsigned char)*p))
         return 0;
-    while (isdigit(*p))
+    while (isdigit((unsigned char)*p))
         p++;
 
 #ifdef __VMS
@@ -623,7 +623,7 @@ static int file_name_check(struct file_ctx_st *ctx, const char *name)
      */
     if (*p == ';')
         for (p++; *p != '\0'; p++)
-            if (!ossl_isdigit(*p))
+            if (!ossl_isdigit((unsigned char)*p))
                 break;
 #endif
 
index 5d5991f502584e7a831c5a61382aef1160384996..3f94d7506e8f41b00f8243f138a1be6d4260932f 100644 (file)
@@ -201,7 +201,7 @@ int fips_provider_version_match(OSSL_LIB_CTX *libctx, const char *versions)
         } else if (*p == '>') {
             mode = MODE_GT;
             p++;
-        } else if (isdigit(*p)) {
+        } else if (isdigit((unsigned char)*p)) {
             mode = MODE_EQ;
         } else {
             TEST_info("Error matching FIPS version: mode %s\n", p);