summaryrefslogtreecommitdiff
path: root/ShellPkg/Library
diff options
context:
space:
mode:
authorScott Duplichan <scott@notabs.org>2014-09-02 19:50:09 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2014-09-02 19:50:09 +0000
commita3d236df1441f07d727e3aa98f865d4695e0a9f4 (patch)
treef9b22946a34ca889d16fb048d346e9b1f0f48190 /ShellPkg/Library
parent8edfdee0dc05e5dfc343fca5fffe334d0b359020 (diff)
downloadedk2-platforms-a3d236df1441f07d727e3aa98f865d4695e0a9f4.tar.xz
ShellPkg: Prevent StrnCpy from overwriting null terminator when source is larger than destination.
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
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r--ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
index 9a85f917bb..8e5434cfd2 100644
--- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
+++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
@@ -618,7 +618,7 @@ IfconfigGetAllNicInfoByHii (
goto ON_ERROR;
}
if (ConfigHdr != NULL) {
- StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100);
+ StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100 - 1);
}
//
@@ -791,7 +791,7 @@ IfconfigSetNicAddrByHii (
goto ON_EXIT;
}
if (ConfigHdr != NULL) {
- StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100);
+ StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100 - 1);
}
NicConfig = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);