stand/multiboot2: fix header length check

Check whether we have reached the end of the buffer using search_size
instead of MULTIBOOT_SEARCH, which is the maximum defined by the
specification, but the file can be shorter than that.

This prevents printing a harmless error message when loading a file
that is smaller than MULTIBOOT_SEARCH.

Sponsored by: Citrix Systems R&D
MFC after: 3 days
Fixes: adda2797eb ('stand/multiboot2: add support for booting a Xen dom0 in UEFI mode')
This commit is contained in:
Roger Pau Monné 2021-02-23 15:56:27 +01:00
parent ab379c15af
commit 0eaa97f0e8

View File

@ -107,7 +107,7 @@ loadfile(char *filename, uint64_t dest, struct preloaded_file **result)
break;
}
if (i >= MULTIBOOT_SEARCH) {
if (i >= search_size) {
error = EFTYPE;
goto out;
}