]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/TcpDxe/TcpMain.c
CryptoPkg/BaseCryptLib.h: Add new API to get organization name
[mirror_edk2.git] / NetworkPkg / TcpDxe / TcpMain.c
index 96a295a7fe309529dfa66eda90912b07f2d3b6bf..fa357cd01a83e38ddf78164cf7f9b4b40d3aee57 100644 (file)
@@ -2,15 +2,9 @@
   Implementation of EFI_TCP4_PROTOCOL and EFI_TCP6_PROTOCOL.\r
 \r
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2009 - 2016, 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
@@ -40,6 +34,9 @@ TcpChkDataBuf (
   UINT32 Len;\r
 \r
   for (Index = 0, Len = 0; Index < FragmentCount; Index++) {\r
+    if (FragmentTable[Index].FragmentBuffer == NULL) {\r
+      return EFI_INVALID_PARAMETER;\r
+    }\r
     Len = Len + FragmentTable[Index].FragmentLength;\r
   }\r
 \r
@@ -147,7 +144,7 @@ Tcp4Configure (
   if (NULL != TcpConfigData) {\r
 \r
     CopyMem (&Ip, &TcpConfigData->AccessPoint.RemoteAddress, sizeof (IP4_ADDR));\r
-    if ((Ip != 0) && !NetIp4IsUnicast (NTOHL (Ip), 0)) {\r
+    if (IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
 \r
@@ -159,7 +156,8 @@ Tcp4Configure (
 \r
       CopyMem (&Ip, &TcpConfigData->AccessPoint.StationAddress, sizeof (IP4_ADDR));\r
       CopyMem (&SubnetMask, &TcpConfigData->AccessPoint.SubnetMask, sizeof (IP4_ADDR));\r
-      if (!NetIp4IsUnicast (NTOHL (Ip), 0) || !IP4_IS_VALID_NETMASK (NTOHL (SubnetMask))) {\r
+      if (!IP4_IS_VALID_NETMASK (NTOHL (SubnetMask)) ||\r
+          (SubnetMask != 0 && !NetIp4IsUnicast (NTOHL (Ip), NTOHL (SubnetMask)))) {\r
         return EFI_INVALID_PARAMETER;\r
       }\r
     }\r