diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2025-07-13 16:08:33 +0200 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2025-07-16 18:46:55 +0200 |
commit | f3355a1fff6fb04f636b9faf15d523c42d4e0041 (patch) | |
tree | 69c8a33ffffc4cdd5d17de1819694b74d2c6c37a /libavformat/tls_openssl.c | |
parent | 576f44016af195a3d8b9278c044b920461c589f9 (diff) | |
download | ffmpeg-f3355a1fff6fb04f636b9faf15d523c42d4e0041.tar.gz |
avformat/tls_openssl: properly limit written size to data mtu
Diffstat (limited to 'libavformat/tls_openssl.c')
-rw-r--r-- | libavformat/tls_openssl.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 900ee0f5ab..8326762592 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -987,9 +987,14 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size) URLContext *uc = c->tls_shared.is_dtls ? c->tls_shared.udp : c->tls_shared.tcp; int ret; + // Set or clear the AVIO_FLAG_NONBLOCK on c->tls_shared.tcp uc->flags &= ~AVIO_FLAG_NONBLOCK; uc->flags |= h->flags & AVIO_FLAG_NONBLOCK; + + if (c->tls_shared.is_dtls) + size = FFMIN(size, DTLS_get_data_mtu(c->ssl)); + ret = SSL_write(c->ssl, buf, size); if (ret > 0) return ret; |