/** @file\r
TCP output process routines.\r
\r
- Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2018, 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
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
BOOLEAN Syn;\r
UINT32 DataLen;\r
\r
- ASSERT ((Nbuf != NULL) && (Nbuf->Tcp == NULL) && (TcpVerifySegment (Nbuf) != 0));\r
+ ASSERT ((Nbuf != NULL) && (Nbuf->Tcp == NULL));\r
+\r
+ if (TcpVerifySegment (Nbuf) == 0) {\r
+ return -1;\r
+ }\r
\r
DataLen = Nbuf->TotalSize;\r
\r
Nbuf = TcpGetSegmentSock (Tcb, Seq, Len);\r
}\r
\r
- ASSERT (TcpVerifySegment (Nbuf) != 0);\r
+ if (TcpVerifySegment (Nbuf) == 0) {\r
+ NetbufFree (Nbuf);\r
+ return NULL;\r
+ }\r
+\r
return Nbuf;\r
}\r
\r
"TcpRetransmit: retransmission without regard to the receiver window for TCB %p\n",\r
Tcb)\r
);\r
- \r
+\r
} else if (TCP_SEQ_GEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {\r
Len = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);\r
- \r
+\r
} else {\r
DEBUG (\r
(EFI_D_WARN,\r
return -1;\r
}\r
\r
- ASSERT (TcpVerifySegment (Nbuf) != 0);\r
+ if (TcpVerifySegment (Nbuf) == 0) {\r
+ goto OnError;\r
+ }\r
\r
if (TcpTransmitSegment (Tcb, Nbuf) != 0) {\r
goto OnError;\r
Seg->End = End;\r
Seg->Flag = Flag;\r
\r
- ASSERT (TcpVerifySegment (Nbuf) != 0);\r
- ASSERT (TcpCheckSndQue (&Tcb->SndQue) != 0);\r
+ if (TcpVerifySegment (Nbuf) == 0 || TcpCheckSndQue (&Tcb->SndQue) == 0) {\r
+ DEBUG (\r
+ (EFI_D_ERROR,\r
+ "TcpToSendData: discard a broken segment for TCB %p\n",\r
+ Tcb)\r
+ );\r
+ goto OnError;\r
+ }\r
\r
//\r
// Don't send an empty segment here.\r
Tcb)\r
);\r
\r
- NetbufFree (Nbuf);\r
- return Sent;\r
+ goto OnError;\r
}\r
\r
if (TcpTransmitSegment (Tcb, Nbuf) != 0) {\r