aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/ClassDriver
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-05-25 06:14:37 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-05-25 06:14:37 +0000
commit4a13a5484ae19974a46d3def668aa888d12b8f13 (patch)
tree79f288666aea4a6f2298bb449bf355daaa5e6ce5 /Demos/Device/ClassDriver
parent8f3d4e69c3ccc88f0572a90a367eeaa98e3675c2 (diff)
downloadlufa-4a13a5484ae19974a46d3def668aa888d12b8f13.tar.gz
lufa-4a13a5484ae19974a46d3def668aa888d12b8f13.tar.bz2
lufa-4a13a5484ae19974a46d3def668aa888d12b8f13.zip
Fixed RNDISEthernet demos crashing when calculating checksums for Ethernet/TCP packets of more than ~500 bytes due to an overflow in the checksum calculation loop (thanks to Kevin Malec).
Removed string Attributes from the Service Discovery Protocol code to minimise the potential points of failure while the base code is being debugged.
Diffstat (limited to 'Demos/Device/ClassDriver')
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c2
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c
index a3a42e22d..e34f824e9 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c
@@ -120,7 +120,7 @@ uint16_t Ethernet_Checksum16(void* Data, uint16_t Bytes)
uint16_t* Words = (uint16_t*)Data;
uint32_t Checksum = 0;
- for (uint8_t CurrWord = 0; CurrWord < (Bytes >> 1); CurrWord++)
+ for (uint16_t CurrWord = 0; CurrWord < (Bytes >> 1); CurrWord++)
Checksum += Words[CurrWord];
while (Checksum & 0xFFFF0000)
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c
index 318085f59..6b62edb13 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c
@@ -608,7 +608,7 @@ static uint16_t TCP_Checksum16(void* TCPHeaderOutStart, IP_Address_t SourceAddre
Checksum += SwapEndian_16(PROTOCOL_TCP);
Checksum += SwapEndian_16(TCPOutSize);
- for (uint8_t CurrWord = 0; CurrWord < (TCPOutSize >> 1); CurrWord++)
+ for (uint16_t CurrWord = 0; CurrWord < (TCPOutSize >> 1); CurrWord++)
Checksum += ((uint16_t*)TCPHeaderOutStart)[CurrWord];
if (TCPOutSize & 0x01)