diff options
author | Shenglei Zhang <shenglei.zhang@intel.com> | 2020-04-24 17:11:07 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-04-26 06:20:32 +0000 |
commit | 0f1946b6626e263c7f764c21cc241cc9faf8a1ae (patch) | |
tree | 923e94bcda857c408e22085cf8d1328a3a797fb6 /NetworkPkg | |
parent | c5c5c980dbaadf32193ac5e4ed2a35b665e0c76e (diff) | |
download | edk2-0f1946b6626e263c7f764c21cc241cc9faf8a1ae.zip edk2-0f1946b6626e263c7f764c21cc241cc9faf8a1ae.tar.gz edk2-0f1946b6626e263c7f764c21cc241cc9faf8a1ae.tar.bz2 |
NetworkPkg/IScsiDxe: Enhance the check for array boundary
Array 'TargetUrl' of size 255 may use index value(s) 255 and 256.
So enhance the boundary check to ensure the index is valid.
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiDhcp.c | 2 | ||||
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiDhcp6.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp.c b/NetworkPkg/IScsiDxe/IScsiDhcp.c index 7ce9bf5..afa8a86 100644 --- a/NetworkPkg/IScsiDxe/IScsiDhcp.c +++ b/NetworkPkg/IScsiDxe/IScsiDhcp.c @@ -122,7 +122,7 @@ IScsiDhcpExtractRootPath ( //
if ((!NET_IS_DIGIT (*(Field->Str))) && (*(Field->Str) != '[')) {
ConfigNvData->DnsMode = TRUE;
- if (Field->Len > sizeof (ConfigNvData->TargetUrl)) {
+ if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {
return EFI_INVALID_PARAMETER;
}
CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c b/NetworkPkg/IScsiDxe/IScsiDhcp6.c index 86a872a..691650b 100644 --- a/NetworkPkg/IScsiDxe/IScsiDhcp6.c +++ b/NetworkPkg/IScsiDxe/IScsiDhcp6.c @@ -161,7 +161,7 @@ IScsiDhcp6ExtractRootPath ( // Server name is expressed as domain name, just save it.
//
if (ConfigNvData->DnsMode) {
- if (Field->Len > sizeof (ConfigNvData->TargetUrl)) {
+ if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {
return EFI_INVALID_PARAMETER;
}
CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
|