]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ssl_old_test.c: Check inconsistent values from SSL_get0_alpn_selected()
authorTomas Mraz <tomas@openssl.org>
Wed, 16 Aug 2023 14:07:10 +0000 (16:07 +0200)
committerTomas Mraz <tomas@openssl.org>
Fri, 18 Aug 2023 13:06:18 +0000 (15:06 +0200)
Fixes Coverity 1534838

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21755)

test/ssl_old_test.c

index 439d0ed8d02c74bd9906f54dcd3b153c79a94f8c..8218ab1a908776efe2150d5d81fe9f3bb5113658 100644 (file)
@@ -332,6 +332,18 @@ static int verify_alpn(SSL *client, SSL *server)
     OPENSSL_free(alpn_selected);
     alpn_selected = NULL;
 
+    if (client_proto == NULL && client_proto_len != 0) {
+        BIO_printf(bio_stdout,
+                   "Inconsistent SSL_get0_alpn_selected() for client!\n");
+        goto err;
+    }
+
+    if (server_proto == NULL && server_proto_len != 0) {
+        BIO_printf(bio_stdout,
+                   "Inconsistent SSL_get0_alpn_selected() for server!\n");
+        goto err;
+    }
+
     if (client_proto_len != server_proto_len) {
         BIO_printf(bio_stdout, "ALPN selected protocols differ!\n");
         goto err;