RFC Errata
RFC 1071, "Computing the Internet checksum", September 1988
Note: This RFC has been updated by RFC 1141
Source of RFC: LegacyArea Assignment: int
Errata ID: 4918
Status: Reported
Type: Editorial
Publication Format(s) : TEXT
Reported By: Cihangir Akturk
Date Reported: 2017-01-26
Section 4.1 says:
while( count > 1 ) { /* This is the inner loop */ sum += * (unsigned short) addr++; count -= 2; }
It should say:
while( count > 1 ) { /* This is the inner loop */ sum += * (unsigned short *) addr; addr += 2; count -= 2; }
Notes:
- In the original text, code incorrectly casts from pointer to integer.
- Increments addr pointer by 1. Because unsigned short is two bytes, it should have been incremented by 2 instead.