[FFmpeg-devel] [PATCH v3 2/3] avformat/tls_openssl: verify setting hostname for SNI

Marvin Scholz epirat07 at gmail.com
Tue Jul 8 21:53:48 EEST 2025


---
 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 7f10d80f9e..248d1eedf9 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -927,7 +927,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) {
-- 
2.39.5 (Apple Git-154)



More information about the ffmpeg-devel mailing list