mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-29 08:01:08 +00:00
efi_loader: parameter checks CalculateCrc32()
Not checking the parameters may lead reading or writing from NULL. Implement the parameter checks prescribed in the UEFI spec. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
226cddbe32
commit
db80fe3866
1 changed files with 8 additions and 1 deletions
|
@ -2465,9 +2465,16 @@ static efi_status_t EFIAPI efi_calculate_crc32(const void *data,
|
|||
efi_uintn_t data_size,
|
||||
u32 *crc32_p)
|
||||
{
|
||||
efi_status_t ret = EFI_SUCCESS;
|
||||
|
||||
EFI_ENTRY("%p, %zu", data, data_size);
|
||||
if (!data || !data_size || !crc32_p) {
|
||||
ret = EFI_INVALID_PARAMETER;
|
||||
goto out;
|
||||
}
|
||||
*crc32_p = crc32(0, data, data_size);
|
||||
return EFI_EXIT(EFI_SUCCESS);
|
||||
out:
|
||||
return EFI_EXIT(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue