openssl: ensure to check SSL_CTX_set_alpn_protos return values

SSL_CTX_set_alpn_protos() return 0 on success, and non-0 on failure

Signed-off-by: Jean-Philippe Menil <jpmenil@gmail.com>

Closes #6794
This commit is contained in:
Jean-Philippe Menil 2021-03-25 17:21:24 +01:00 committed by Daniel Stenberg
parent 7b6bfd2d78
commit 5930cb1c46
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 4 additions and 1 deletions

View File

@ -2749,7 +2749,10 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
/* expects length prefixed preference ordered list of protocols in wire
* format
*/
SSL_CTX_set_alpn_protos(backend->ctx, protocols, cur);
if(SSL_CTX_set_alpn_protos(backend->ctx, protocols, cur)) {
failf(data, "Error setting ALPN");
return CURLE_SSL_CONNECT_ERROR;
}
}
#endif