From: Hugo Landau Date: Tue, 18 Jul 2023 15:15:15 +0000 (+0100) Subject: QUIC TXP: Fix bug relating to STREAM FIN generation X-Git-Tag: openssl-3.2.0-alpha1~347 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=553122cd7cefaad68826f37455c7644dc6cd72b9;p=thirdparty%2Fopenssl.git QUIC TXP: Fix bug relating to STREAM FIN generation Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/21484) --- diff --git a/ssl/quic/quic_txp.c b/ssl/quic/quic_txp.c index 1f3715e1707..55755eddf8f 100644 --- a/ssl/quic/quic_txp.c +++ b/ssl/quic/quic_txp.c @@ -2141,6 +2141,13 @@ static int txp_generate_stream_frames(OSSL_QUIC_TX_PACKETISER *txp, if (shdr->is_fin) chunks[(i + 1) % 2].valid = 0; + /* + * We are now committed to our length (shdr->len can't change). + * If we truncated the chunk, clear the FIN bit. + */ + if (shdr->len < orig_len) + shdr->is_fin = 0; + /* Truncate IOVs to match our chosen length. */ ossl_quic_sstream_adjust_iov((size_t)shdr->len, chunks[i % 2].iov, chunks[i % 2].num_stream_iovec);