From a3d236df1441f07d727e3aa98f865d4695e0a9f4 Mon Sep 17 00:00:00 2001 From: Scott Duplichan Date: Tue, 2 Sep 2014 19:50:09 +0000 Subject: [PATCH] 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 Reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16035 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 4 ++-- 1 file 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); -- 2.39.2