ssl_old_test.c: Check inconsistent values from SSL_get0_alpn_selected()

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)
This commit is contained in:
Tomas Mraz 2023-08-16 16:07:10 +02:00
parent 20baa24f9f
commit 8b940b6945
1 changed files with 12 additions and 0 deletions

View 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;