]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Prevent StrnCpy from overwriting null terminator when source is larger...
authorScott Duplichan <scott@notabs.org>
Tue, 2 Sep 2014 19:50:09 +0000 (19:50 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 2 Sep 2014 19:50:09 +0000 (19:50 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <scott@notabs.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16035 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c

index 9a85f917bb8d7e2db134cef6c450f0dd59c12458..8e5434cfd26ae9dd03c209992a6aed96ba7844fe 100644 (file)
@@ -618,7 +618,7 @@ IfconfigGetAllNicInfoByHii (
       goto ON_ERROR;\r
     }\r
     if (ConfigHdr != NULL) {\r
-      StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100);\r
+      StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100 - 1);\r
     }\r
  \r
     //\r
@@ -791,7 +791,7 @@ IfconfigSetNicAddrByHii (
     goto ON_EXIT;\r
   }\r
   if (ConfigHdr != NULL) {\r
-    StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100);\r
+    StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100 - 1);\r
   }\r
 \r
   NicConfig = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);\r