From 8bc2d00d53cc5174cdc6402ae5797cc40d7ac7f1 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Fri, 21 Nov 2025 07:47:20 -0800 Subject: [PATCH] Internal change. PiperOrigin-RevId: 835221634 --- test/util/socket_util.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/util/socket_util.cc b/test/util/socket_util.cc index 7a1b232fb2..071f5afe40 100644 --- a/test/util/socket_util.cc +++ b/test/util/socket_util.cc @@ -900,14 +900,14 @@ TestAddress V6MulticastLinkLocalAllRouters() { uint16_t Checksum(uint16_t* buf, ssize_t buf_size) { // Add up the 16-bit values in the buffer. uint32_t total = 0; - for (unsigned int i = 0; i < buf_size; i += sizeof(*buf)) { + for (unsigned int i = 0; i < buf_size - 1; i += sizeof(*buf)) { total += *buf; buf++; } // If buf has an odd size, add the remaining byte. if (buf_size % 2) { - total += *(reinterpret_cast(buf) - 1); + total += *(reinterpret_cast(buf)); } // This carries any bits past the lower 16 until everything fits in 16 bits.