mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-08-03 01:55:21 +00:00
verify_buffer: check that the value of cert->Hdr.dwLength is reasonable
Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
b8e27b3cfe
commit
2de084689f
10
shim.c
10
shim.c
@ -915,6 +915,11 @@ static EFI_STATUS verify_buffer (char *data, int datasize,
|
||||
unsigned int size = datasize;
|
||||
|
||||
if (context->SecDir->Size != 0) {
|
||||
if (context->SecDir->Size >= size) {
|
||||
perror(L"Certificate Database size is too large\n");
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
cert = ImageAddress (data, size,
|
||||
context->SecDir->VirtualAddress);
|
||||
|
||||
@ -923,6 +928,11 @@ static EFI_STATUS verify_buffer (char *data, int datasize,
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (cert->Hdr.dwLength > context->SecDir->Size) {
|
||||
perror(L"Certificate list size is inconsistent with PE headers");
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (cert->Hdr.wCertificateType !=
|
||||
WIN_CERT_TYPE_PKCS_SIGNED_DATA) {
|
||||
perror(L"Unsupported certificate type %x\n",
|
||||
|
Loading…
Reference in New Issue
Block a user