From: Ard Biesheuvel Date: Thu, 29 Nov 2018 12:19:50 +0000 (+0100) Subject: BaseTools/DevicePath: use MAX_UINT32 as default device path max size X-Git-Tag: edk2-stable201903~521 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=c0b7379a31091f9640f7d6592222b286669ef510 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 Reviewed-by: Jaben Carsey Reviewed-by: Laszlo Ersek Reviewed-by: Liming Gao --- diff --git a/BaseTools/Source/C/DevicePath/DevicePathUtilities.c b/BaseTools/Source/C/DevicePath/DevicePathUtilities.c index d4ec2742b7..f8a41ff97d 100644 --- a/BaseTools/Source/C/DevicePath/DevicePathUtilities.c +++ b/BaseTools/Source/C/DevicePath/DevicePathUtilities.c @@ -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;