Dhcp6 internal functions implementation.\r
\r
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2016 Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
return ;\r
}\r
\r
+ if (Udp6Wrap->TotalSize < sizeof (EFI_DHCP6_HEADER)) {\r
+ goto ON_CONTINUE;\r
+ }\r
+\r
//\r
// Copy the net buffer received from upd6 to a Dhcp6 packet.\r
//\r
}\r
\r
ASSERT (Packet != NULL);\r
+\r
+ if (Packet->TotalSize <= sizeof (DNS_HEADER)) {\r
+ goto ON_EXIT;\r
+ }\r
\r
RcvString = NetbufGetByte (Packet, 0, NULL);\r
ASSERT (RcvString != NULL);\r
//\r
ParseDnsResponse (Instance, RcvString, &Completed);\r
\r
- ON_EXIT:\r
+ON_EXIT:\r
\r
- if (Packet != NULL) {\r
- NetbufFree (Packet);\r
- }\r
+ if (Packet != NULL) {\r
+ NetbufFree (Packet);\r
+ }\r
\r
- if (!Completed) {\r
- UdpIoRecvDatagram (Instance->UdpIo, DnsOnPacketReceived, Instance, 0);\r
- }\r
+ if (!Completed) {\r
+ UdpIoRecvDatagram (Instance->UdpIo, DnsOnPacketReceived, Instance, 0);\r
+ }\r
}\r
\r
/**\r
/** @file\r
TCP input process routines.\r
\r
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2016 Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
Head = (TCP_HEAD *) NetbufGetByte (Nbuf, 0, NULL);\r
ASSERT (Head != NULL);\r
+ \r
+ if (Nbuf->TotalSize < sizeof (TCP_HEAD)) {\r
+ DEBUG ((EFI_D_INFO, "TcpInput: received a malformed packet\n"));\r
+ goto DISCARD;\r
+ }\r
+ \r
Len = Nbuf->TotalSize - (Head->HeadLen << 2);\r
\r
if ((Head->HeadLen < 5) || (Len < 0)) {\r
\r
DEBUG ((EFI_D_INFO, "TcpInput: received a malformed packet\n"));\r
+ \r
goto DISCARD;\r
}\r
\r
BOOLEAN IcmpErrIsHard;\r
BOOLEAN IcmpErrNotify;\r
\r
+ if (Nbuf->TotalSize < sizeof (TCP_HEAD)) {\r
+ goto CLEAN_EXIT;\r
+ }\r
+ \r
Head = (TCP_HEAD *) NetbufGetByte (Nbuf, 0, NULL);\r
ASSERT (Head != NULL);\r
\r
/** @file\r
Udp6 driver's whole implementation.\r
\r
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2016 Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
EFI_UDP6_SESSION_DATA *Udp6Session;\r
UINTN Enqueued;\r
\r
+ if (Packet->TotalSize < sizeof (EFI_UDP_HEADER)) {\r
+ NetbufFree (Packet);\r
+ return;\r
+ }\r
+ \r
//\r
// Get the datagram header from the packet buffer.\r
//\r
//\r
// Wrong checksum.\r
//\r
+ NetbufFree (Packet);\r
return;\r
}\r
}\r
LIST_ENTRY *Entry;\r
UDP6_INSTANCE_DATA *Instance;\r
\r
+ if (Packet->TotalSize < sizeof (EFI_UDP_HEADER)) {\r
+ NetbufFree (Packet);\r
+ return;\r
+ }\r
+ \r
Udp6Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);\r
ASSERT (Udp6Header != NULL);\r
\r