Cleanups to RNDIS device demos. Fix issue in RNDIS demos where the memory would becom...
[pub/lufa.git] / Demos / Device / ClassDriver / RNDISEthernet / Lib / Ethernet.c
index fb6bb1a..70033f5 100644 (file)
@@ -59,7 +59,7 @@ const IP_Address_t  ClientIPAddress     = {CLIENT_IP_ADDRESS};
  */\r
 void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* FrameIN, Ethernet_Frame_Info_t* FrameOUT)\r
 {\r
-       DecodeEthernetFrameHeader(FrameIN->FrameData);\r
+       DecodeEthernetFrameHeader(FrameIN);\r
 \r
        /* Cast the incoming Ethernet frame to the Ethernet header type */\r
        Ethernet_Frame_Header_t* FrameINHeader  = (Ethernet_Frame_Header_t*)&FrameIN->FrameData;\r
@@ -69,7 +69,8 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* FrameIN, Ethernet_Frame_Info_
        \r
        /* Ensure frame is addressed to either all (broadcast) or the virtual webserver, and is a type II frame */\r
        if ((MAC_COMPARE(&FrameINHeader->Destination, &ServerMACAddress) ||\r
-            MAC_COMPARE(&FrameINHeader->Destination, &BroadcastMACAddress)))\r
+            MAC_COMPARE(&FrameINHeader->Destination, &BroadcastMACAddress)) &&\r
+                (SwapEndian_16(FrameIN->FrameLength) > ETHERNET_VER2_MINSIZE))\r
        {\r
                /* Process the packet depending on its protocol */\r
                switch (SwapEndian_16(FrameINHeader->EtherType))\r