aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-11-05 13:39:48 -0800
committerFlorin Coras <fcoras@cisco.com>2020-11-05 13:58:52 -0800
commit1f85dad1e5f85b049c1bf829aca7aa6ad0b4fc70 (patch)
treed6a13c179b6fdee328945289d038568dd1839087 /src/vnet/tcp
parentc4e6cd088909466a7c13d2ec72a9107d75125da9 (diff)
tcp: avoid consuming trailing bytes
Thanks to Shaligram Prakash <Shaligram.Prakash@enea.com> for reporting. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I135d23957a0dbb56a30994dfe3a316efd1eabad1
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r--src/vnet/tcp/tcp_input.c4
1 files changed, 4 insertions, 0 deletions
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))
{