Fix UDP checksum calculation (fixes #360)

Missing parantheses around the calculation of last byte address in a UDP
Packet led to dereferencing the wrong value, thereby the UDP checksum
calculation failed, whenever an odd byte-count UPD packet was calculated.
Many thanks to Markus Partheymueller who discovered this issue and its
resolution.
This commit is contained in:
Stefan Kalkowski 2012-09-18 09:23:09 +02:00 committed by Norman Feske
parent 97c3f6599d
commit 5c36639031
1 changed files with 1 additions and 1 deletions

View File

@ -136,7 +136,7 @@ namespace Net {
/* if udp length is odd, append a zero byte */
if (length() & 1) {
Genode::uint8_t last[] =
{ *(Genode::uint8_t*)this + (length()-1), 0 };
{ *((Genode::uint8_t*)this + (length()-1)), 0 };
sum += bswap(*(Genode::uint16_t*)&last);
}