From 1f85dad1e5f85b049c1bf829aca7aa6ad0b4fc70 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Thu, 5 Nov 2020 13:39:48 -0800 Subject: [PATCH] tcp: avoid consuming trailing bytes Thanks to Shaligram Prakash for reporting. Type: fix Signed-off-by: Florin Coras Change-Id: I135d23957a0dbb56a30994dfe3a316efd1eabad1 --- src/vnet/tcp/tcp_input.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c index ce1c9d5ff10..305e2d34461 100644 --- a/src/vnet/tcp/tcp_input.c +++ b/src/vnet/tcp/tcp_input.c @@ -1298,6 +1298,10 @@ tcp_segment_rcv (tcp_worker_ctx_t * wrk, tcp_connection_t * tc, ASSERT (n_data_bytes); tc->data_segs_in += 1; + /* Make sure we don't consume trailing bytes */ + if (PREDICT_FALSE (b->current_length != n_data_bytes)) + b->current_length = n_data_bytes; + /* Handle out-of-order data */ if (PREDICT_FALSE (vnet_buffer (b)->tcp.seq_number != tc->rcv_nxt)) { -- 2.16.6