Skip to content

Commit 7c4d109

Browse files
committed
Internal change.
PiperOrigin-RevId: 834916625
1 parent 43ca398 commit 7c4d109

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/util/socket_util.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,14 +900,14 @@ TestAddress V6MulticastLinkLocalAllRouters() {
900900
uint16_t Checksum(uint16_t* buf, ssize_t buf_size) {
901901
// Add up the 16-bit values in the buffer.
902902
uint32_t total = 0;
903-
for (unsigned int i = 0; i < buf_size; i += sizeof(*buf)) {
903+
for (unsigned int i = 0; i < buf_size - 1; i += sizeof(*buf)) {
904904
total += *buf;
905905
buf++;
906906
}
907907

908908
// If buf has an odd size, add the remaining byte.
909909
if (buf_size % 2) {
910-
total += *(reinterpret_cast<unsigned char*>(buf) - 1);
910+
total += *(reinterpret_cast<unsigned char*>(buf));
911911
}
912912

913913
// This carries any bits past the lower 16 until everything fits in 16 bits.

0 commit comments

Comments
 (0)