]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Coverity 1516624: Fix overrun memory access.
authorPauli <pauli@openssl.org>
Wed, 2 Nov 2022 01:20:16 +0000 (12:20 +1100)
committerTomas Mraz <tomas@openssl.org>
Thu, 3 Nov 2022 09:31:29 +0000 (10:31 +0100)
Not possible to hit but good to address.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19576)

test/punycode_test.c

index 113d04b7a98901e4200881d5a986fda880bc6f8a..9d8171346caa82c59cd392816c246a1dcc9a7aeb 100644 (file)
@@ -154,7 +154,7 @@ static int test_punycode(int n)
     if (!TEST_true(ossl_punycode_decode(tc->encoded, strlen(tc->encoded),
                                         buffer, &bsize)))
         return 0;
-    for (i = 0; i < sizeof(tc->raw); i++)
+    for (i = 0; i < OSSL_NELEM(tc->raw); i++)
         if (tc->raw[i] == 0)
             break;
     if (!TEST_mem_eq(buffer, bsize * sizeof(*buffer),