mirror of https://github.com/acidanthera/audk.git
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:
parent
8edfdee0dc
commit
a3d236df14
|
@ -618,7 +618,7 @@ IfconfigGetAllNicInfoByHii (
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
if (ConfigHdr != NULL) {
|
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;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
if (ConfigHdr != NULL) {
|
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);
|
NicConfig = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);
|
||||||
|
|
Loading…
Reference in New Issue