]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Refine code to make it more safely.
authorEric Dong <eric.dong@intel.com>
Wed, 25 Jun 2014 05:44:37 +0000 (05:44 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 25 Jun 2014 05:44:37 +0000 (05:44 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15589 6f19259b-4bc3-4df7-8a09-765794883524

NetworkPkg/Application/IfConfig6/IfConfig6.c
NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
NetworkPkg/Ip6Dxe/Ip6ConfigNv.c
NetworkPkg/IpSecDxe/Ikev2/Utility.c
NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c

index a2a35822774e4e4e8bbea960a397165e5e18ccfb..36cc7499338ba5ba906d82775408ad3f44de7836 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation for Shell application IfConfig6.\r
 \r
-  Copyright (c) 2009 - 2011, 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
@@ -365,6 +365,7 @@ IfConfig6ParseManualAddressList (
   UINT8                            Prefix;\r
   UINT8                            AddrCnt;\r
 \r
+  Prefix   = 0;\r
   AddrCnt  = 0;\r
   *BufSize = 0;\r
   *Buf     = NULL;\r
index 7591bf56bab2bda372d1c1bfa97c75deabcc14c6..8603669903fb5acd6ea0651470eb08f4ec843e3c 100644 (file)
@@ -143,10 +143,10 @@ Dhcp6GenerateClientId (
     //\r
     // Set the Duid-type, hardware-type, time and copy the hardware address.\r
     //\r
-    WriteUnaligned16 ((UINT16 *) (Duid->Duid), HTONS (Dhcp6DuidTypeLlt));\r
-    WriteUnaligned16 ((UINT16 *) (Duid->Duid + 2), HTONS (NET_IFTYPE_ETHERNET));\r
-    WriteUnaligned32 ((UINT32 *) (Duid->Duid + 4), HTONL (Stamp));\r
-  \r
+    WriteUnaligned16 ((UINT16 *) ((UINT8 *)&Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid)), HTONS (Dhcp6DuidTypeLlt));\r
+    WriteUnaligned16 ((UINT16 *) ((UINT8 *)&Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid) + 2), HTONS (NET_IFTYPE_ETHERNET));\r
+    WriteUnaligned32 ((UINT32 *) ((UINT8 *)&Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid) + 4), HTONL (Stamp));\r
+\r
     CopyMem (Duid->Duid + 8, &Mode->CurrentAddress, Mode->HwAddressSize);\r
   }\r
 \r
index eaeb44b2a1cf803c6db3c8b494a8ce4af070db85..4716f797d4cd8f878d08354a4f7c0a431fd2afdc 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Helper functions for configuring or obtaining the parameters relating to IP6.\r
 \r
-  Copyright (c) 2010 - 2013, 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
@@ -600,6 +600,7 @@ Ip6ParseAddressListFromString (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  ZeroMem (&AddressInfo, sizeof (EFI_IP6_ADDRESS_INFO));\r
   LocalString = (CHAR16 *) AllocateCopyPool (StrSize (String), String);\r
   if (LocalString == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
index f12766f3cbdadad5d1be988286555392c377e978..cb436b65a69eb09b7f0d760e3570fd1bf60e163e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The Common operations used by IKE Exchange Process.\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
@@ -928,6 +928,7 @@ Ikev2ChildSaSilentDelete (
       FreePool (Selector);\r
 \r
       Selector = AllocateZeroPool (SelectorSize);\r
+      ASSERT (Selector != NULL);\r
       Status   = EfiIpSecConfigGetNextSelector (\r
                    &Private->IpSecConfig,\r
                    IPsecConfigDataTypeSad,\r
index 7175e107bb1458f23c8090e04dbc2c457f53de8b..be3d248fa9f11e4dbb5570b96f584ec168084031 100644 (file)
@@ -600,6 +600,7 @@ EfiPxeBcDiscover (
     if (EFI_ERROR (Status)) {\r
       goto ON_EXIT;\r
     }\r
+    ASSERT (NewCreatedInfo != NULL);\r
     Info = NewCreatedInfo;\r
   } else {\r
     //\r