diff options
author | John Lo <loj@cisco.com> | 2019-04-09 10:23:56 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-04-10 00:35:35 +0000 |
commit | 1cf0007f394fde9beda3aa5150aac581a1075cf2 (patch) | |
tree | aac3732166fd3fe563ae86e3f862181da5ff39b0 | |
parent | 5763e47b7d0d9de7a46541e432abee39e17b5f1e (diff) |
Make tcp/udp/icmp compute checksum safer for buffer-chain case
Change-Id: I046e481a67fbeffdaa8504c8d77d232b986a61ee
Signed-off-by: John Lo <loj@cisco.com>
-rw-r--r-- | src/vnet/ip/ip4_forward.c | 2 | ||||
-rw-r--r-- | src/vnet/ip/ip6_forward.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c index 4a2d413f53a..85e6607a963 100644 --- a/src/vnet/ip/ip4_forward.c +++ b/src/vnet/ip/ip4_forward.c @@ -1174,7 +1174,7 @@ ip4_tcp_udp_compute_checksum (vlib_main_t * vm, vlib_buffer_t * p0, ASSERT (p0->flags & VLIB_BUFFER_NEXT_PRESENT); p0 = vlib_get_buffer (vm, p0->next_buffer); data_this_buffer = vlib_buffer_get_current (p0); - n_this_buffer = p0->current_length; + n_this_buffer = clib_min (p0->current_length, n_bytes_left); } sum16 = ~ip_csum_fold (sum0); diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index f1f291da8a2..6df3d4b036b 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -1011,7 +1011,7 @@ ip6_tcp_udp_icmp_compute_checksum (vlib_main_t * vm, vlib_buffer_t * p0, } p0 = vlib_get_buffer (vm, p0->next_buffer); data_this_buffer = vlib_buffer_get_current (p0); - n_this_buffer = p0->current_length; + n_this_buffer = clib_min (p0->current_length, n_bytes_left); } sum16 = ~ip_csum_fold (sum0); |