]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update network stack code to use StrnCpy instead of StrCpy.
authorFu, Siyuan <siyuan.fu@intel.com>
Fri, 8 Aug 2014 00:41:14 +0000 (00:41 +0000)
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 8 Aug 2014 00:41:14 +0000 (00:41 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu, Siyuan <siyuan.fu@intel.com>
Reviewed-By: Dong, Eric <eric.dong@intel.com>
Reviewed-by: Wu, Jiaxin <jiaxin.wu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15773 6f19259b-4bc3-4df7-8a09-765794883524

NetworkPkg/Application/IfConfig6/IfConfig6.c
NetworkPkg/Dhcp6Dxe/ComponentName.c
NetworkPkg/IScsiDxe/IScsiMisc.c
NetworkPkg/Ip6Dxe/Ip6ConfigNv.c
NetworkPkg/IpSecDxe/Ikev2/Payload.c

index 36cc7499338ba5ba906d82775408ad3f44de7836..9e228ca7bc76b50e5af6ecb204f86e07f746fce3 100644 (file)
@@ -136,7 +136,7 @@ SplitStrToList (
   //\r
   Str     = (CHAR16 *) AllocateZeroPool (StrSize (String));\r
   ASSERT (Str != NULL);\r
-  Str     = StrCpy (Str, String);\r
+  Str     = StrnCpy (Str, String, StrLen (String));\r
   ArgStr  = Str;\r
 \r
   //\r
@@ -1720,7 +1720,7 @@ IfConfig6Initialize (
       Str             = (CHAR16 *) AllocateZeroPool (StrSize (ValueStr));\r
       ASSERT (Str != NULL);\r
 \r
-      Str             = StrCpy (Str, ValueStr);\r
+      Str             = StrnCpy (Str, ValueStr, StrLen (ValueStr));\r
       Private->IfName = Str;\r
     }\r
   }\r
@@ -1734,7 +1734,7 @@ IfConfig6Initialize (
       Str             = (CHAR16 *) AllocateZeroPool (StrSize (ValueStr));\r
       ASSERT (Str != NULL);\r
 \r
-      Str             = StrCpy (Str, ValueStr);\r
+      Str             = StrnCpy (Str, ValueStr, StrLen (ValueStr));\r
       Private->IfName = Str;\r
     }\r
   }\r
index 352df087f91b11afd0e881b783de6cf8555467dc..c7fd6075df92121eabe7481efdf37c83e8df74a6 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   UEFI Component Name(2) protocol implementation for Dhcp6 driver.\r
 \r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2014, 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
@@ -281,7 +281,7 @@ UpdateName (
   if (Dhcp6ModeData.Ia == NULL) {\r
     UnicodeSPrint (HandleName, sizeof (HandleName), L"DHCPv6 (No configured IA)");\r
   } else {\r
-    StrCpy (HandleName, mDhcp6ControllerName[Dhcp6ModeData.Ia->State]);\r
+    StrnCpy (HandleName, mDhcp6ControllerName[Dhcp6ModeData.Ia->State], sizeof (HandleName) / sizeof (CHAR16) - 1);\r
   }\r
   \r
   Status = AddUnicodeString2 (\r
index 444d6f062e197dc58ccdfa4f7afc1378648b79bb..1968cc9370d91f1f2bd00eff75e60222c51be29d 100644 (file)
@@ -209,7 +209,7 @@ IScsiLunToUnicodeStr (
   for (Index = 0; Index < 4; Index++) {\r
 \r
     if ((Lun[2 * Index] | Lun[2 * Index + 1]) == 0) {\r
-      StrCpy (TempStr, L"0-");\r
+      StrnCpy (TempStr, L"0-", StrLen (L"0-"));\r
     } else {\r
       TempStr[0]  = (CHAR16) IScsiHexString[Lun[2 * Index] >> 4];\r
       TempStr[1]  = (CHAR16) IScsiHexString[Lun[2 * Index] & 0x0F];\r
index 4716f797d4cd8f878d08354a4f7c0a431fd2afdc..19328e6e5ebee1880cfb0fa172b5e5f233fed34d 100644 (file)
@@ -718,9 +718,9 @@ Ip6ConvertInterfaceInfoToString (
   // Print the interface type.\r
   //\r
   if (IfInfo->IfType == Ip6InterfaceTypeEthernet) {\r
-    StrCpy (PortString, IP6_ETHERNET);\r
+    StrnCpy (PortString, IP6_ETHERNET, sizeof (PortString) / sizeof (CHAR16) - 1);\r
   } else if (IfInfo->IfType == Ip6InterfaceTypeExperimentalEthernet) {\r
-    StrCpy (PortString, IP6_EXPERIMENTAL_ETHERNET);\r
+    StrnCpy (PortString, IP6_EXPERIMENTAL_ETHERNET, sizeof (PortString) / sizeof (CHAR16) - 1);\r
   } else {\r
     //\r
     // Refer to RFC1700, chapter Number Hardware Type.\r
@@ -747,9 +747,9 @@ Ip6ConvertInterfaceInfoToString (
   for (Index = 0; Index < IfInfo->HwAddressSize; Index++) {\r
 \r
     if (IfInfo->HwAddress.Addr[Index] < 0x10) {\r
-      StrCpy (FormatString, L"0%x-");\r
+      StrnCpy (FormatString, L"0%x-", sizeof (FormatString) / sizeof (CHAR16) - 1);\r
     } else {\r
-      StrCpy (FormatString, L"%x-");\r
+      StrnCpy (FormatString, L"%x-", sizeof (FormatString) / sizeof (CHAR16) - 1);\r
     }\r
 \r
     Number = UnicodeSPrint (\r
index c1e134804c34f4ca2e4dd2def3ef7d9e606aed1c..6a2fdb83f3e84daf64f5d6cf2b24fdc8fd3f02ed 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation of Payloads Creation.\r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2014, 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
@@ -1393,7 +1393,7 @@ Ikev2ParserNotifyCookiePayload (
 \r
   CopyMem (\r
     IkeSaSession->NCookie,\r
-    NotifyPayload + sizeof (IKEV2_NOTIFY),\r
+    (UINT8 *)NotifyPayload + sizeof (IKEV2_NOTIFY),\r
     NotifyDataSize\r
     );\r
 \r