From 5c366390314ab3dae586372e98052769dd066ac3 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Tue, 18 Sep 2012 09:23:09 +0200 Subject: [PATCH] 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. --- os/include/net/udp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/include/net/udp.h b/os/include/net/udp.h index cd162b175b..2dbaaa6960 100644 --- a/os/include/net/udp.h +++ b/os/include/net/udp.h @@ -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); }