BaseTools/DevicePath: use MAX_UINT32 as default device path max size

Replace the default size limit of IsDevicePathValid() with a value
that does not depend on the native word size of the build host.

4 GiB seems sufficient as the upper bound of a device path handled
by UEFI.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Ard Biesheuvel 2018-11-29 13:19:50 +01:00
parent 4d393eb876
commit c0b7379a31
1 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ IsDevicePathValid (
ASSERT (DevicePath != NULL);
if (MaxSize == 0) {
MaxSize = MAX_UINTN;
MaxSize = MAX_UINT32;
}
//
@ -78,7 +78,7 @@ IsDevicePathValid (
return FALSE;
}
if (NodeLength > MAX_UINTN - Size) {
if (NodeLength > MAX_UINT32 - Size) {
return FALSE;
}
Size += NodeLength;