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
This commit is contained in:
Scott Duplichan 2014-09-02 19:50:09 +00:00 committed by jcarsey
parent 8edfdee0dc
commit a3d236df14
1 changed files with 2 additions and 2 deletions

View File

@ -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);