Check that sk_SSL_CIPHER_value returns non-NULL value.
authorDaniel Fiala <daniel@openssl.org>
Sun, 18 Sep 2022 05:36:36 +0000 (07:36 +0200)
committerTomas Mraz <tomas@openssl.org>
Tue, 20 Sep 2022 16:27:53 +0000 (18:27 +0200)
Fixes openssl#19162.

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

(cherry picked from commit 630d31219b343d2654ab03d2e2c7884e764936ab)

apps/ciphers.c

index 4dc3fa94549add36c3e77a3546454799c08b5b2b..42a0bb79f6514de2242fa65d5a5fd4eaaf1c911e 100644 (file)
@@ -227,6 +227,10 @@ int ciphers_main(int argc, char **argv)
     if (!verbose) {
         for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {
             const SSL_CIPHER *c = sk_SSL_CIPHER_value(sk, i);
+
+            if (!ossl_assert(c != NULL))
+                continue;
+
             p = SSL_CIPHER_get_name(c);
             if (p == NULL)
                 break;
@@ -242,6 +246,9 @@ int ciphers_main(int argc, char **argv)
 
             c = sk_SSL_CIPHER_value(sk, i);
 
+            if (!ossl_assert(c != NULL))
+                continue;
+
             if (Verbose) {
                 unsigned long id = SSL_CIPHER_get_id(c);
                 int id0 = (int)(id >> 24);