1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-14 15:23:24 +00:00

Catch the case of empty SNI host to prevent OpenSSL error

This commit is contained in:
Gerhard Rieger 2023-10-26 14:52:53 +02:00
parent 43eb003245
commit 797d0f9695
4 changed files with 40 additions and 181 deletions

View file

@ -448,8 +448,9 @@ int _xioopen_openssl_connect(struct single *xfd,
#if defined(HAVE_SSL_set_tlsext_host_name) || defined(SSL_set_tlsext_host_name)
if (!no_sni) {
/*Warn1("_xioopen_openssl_connect(): calling SSL_set_tlsext_host_name(snihost=\"%s\")", snihost?snihost:"NULL");*/
if (!SSL_set_tlsext_host_name(ssl, snihost)) {
if (snihost == NULL || strlen(snihost) == 0) {
Warn("refusing to set empty SNI host name");
} else if (!SSL_set_tlsext_host_name(ssl, snihost)) {
Error1("Failed to set SNI host \"%s\"", snihost);
sycSSL_free(xfd->para.openssl.ssl);
xfd->para.openssl.ssl = NULL;