summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2024-04-09 12:03:53 +0200
committerFlorin Coras <florin.coras@gmail.com>2024-04-11 01:06:03 +0000
commit11f7965350e78ebe12442f8b165bfc721f3c39e2 (patch)
tree20560a41930f88d75a18af94a2507e1bbd1f9819 /src
parentaa78631d755bf9f55532935599b9964f943a27f3 (diff)
tcp: check for header truncation
Type: fix Change-Id: I0a43a37971d03a700926d59e848f0b6e6dbeb19a Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/tcp/tcp_format.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vnet/tcp/tcp_format.c b/src/vnet/tcp/tcp_format.c
index 751042ce1cd..4674f2cbaed 100644
--- a/src/vnet/tcp/tcp_format.c
+++ b/src/vnet/tcp/tcp_format.c
@@ -139,7 +139,9 @@ format_tcp_header (u8 * s, va_list * args)
clib_net_to_host_u16 (tcp->window),
clib_net_to_host_u16 (tcp->checksum));
- if (tcp_options_parse (tcp, &opts, tcp_is_syn (tcp)) < 0)
+ if (header_bytes > max_header_bytes)
+ s = format (s, "\n%Uoptions: truncated", format_white_space, indent);
+ else if (tcp_options_parse (tcp, &opts, tcp_is_syn (tcp)) < 0)
s = format (s, "\n%Uoptions: parsing failed", format_white_space, indent);
else
s = format (s, "\n%U%U", format_white_space, indent, format_tcp_options,