mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-08-03 05:32:51 +00:00
Make sure the variables are not broken
This commit is contained in:
parent
6306b495c5
commit
6919a3f7c7
@ -101,6 +101,9 @@ static MokListNode *build_mok_list(UINT32 num, void *Data, UINTN DataSize) {
|
||||
int i;
|
||||
void *ptr;
|
||||
|
||||
if (DataSize < sizeof(UINT32))
|
||||
return NULL;
|
||||
|
||||
list = AllocatePool(sizeof(MokListNode) * num);
|
||||
|
||||
if (!list) {
|
||||
@ -478,7 +481,7 @@ static EFI_STATUS check_mok_request(EFI_HANDLE image_handle)
|
||||
efi_status = get_variable(L"MokNew", shim_lock_guid, &attributes,
|
||||
&MokNewSize, &MokNew);
|
||||
|
||||
if (efi_status != EFI_SUCCESS) {
|
||||
if (efi_status != EFI_SUCCESS || MokNewSize < sizeof(UINT32)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
5
shim.c
5
shim.c
@ -107,6 +107,9 @@ static MokListNode *build_mok_list(UINT32 num, void *Data, UINTN DataSize) {
|
||||
int i, remain = DataSize;
|
||||
void *ptr;
|
||||
|
||||
if (DataSize < sizeof(UINT32))
|
||||
return NULL;
|
||||
|
||||
list = AllocatePool(sizeof(MokListNode) * num);
|
||||
|
||||
if (!list) {
|
||||
@ -601,7 +604,7 @@ static EFI_STATUS verify_buffer (char *data, int datasize,
|
||||
status = get_variable(L"MokList", shim_lock_guid, &attributes,
|
||||
&MokListDataSize, &MokListData);
|
||||
|
||||
if (status != EFI_SUCCESS) {
|
||||
if (status != EFI_SUCCESS || MokListDataSize < sizeof(UINT32)) {
|
||||
status = EFI_ACCESS_DENIED;
|
||||
Print(L"Invalid signature\n");
|
||||
goto done;
|
||||
|
Loading…
Reference in New Issue
Block a user