From f4befeb7674978738ce3c7256545dfa49f3e40d7 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Tue, 8 Jul 2025 19:52:48 +0200 Subject: [PATCH] avformat/tls_openssl: verify setting hostname for SNI --- libavformat/tls_openssl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 7845335811..49f26860b1 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -962,7 +962,11 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op ret = AVERROR_EXTERNAL; goto fail; } - SSL_set_tlsext_host_name(p->ssl, c->host); + if (!SSL_set_tlsext_host_name(p->ssl, c->host)) { + av_log(h, AV_LOG_ERROR, "Failed to set hostname for SNI: %s\n", openssl_get_error(p)); + ret = AVERROR_EXTERNAL; + goto fail; + } } ret = c->listen ? SSL_accept(p->ssl) : SSL_connect(p->ssl); if (ret == 0) {