/** @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