diff options
| author | Peter Jones <pjones@redhat.com> | 2022-05-18 17:11:55 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2022-05-23 16:49:53 -0400 |
| commit | 1eca363afe1e48f5aa1ee3c70f2042e9c511692e (patch) | |
| tree | f15d1a612722b2f55a4d486f655230b7ad88170a | |
| parent | 0214cd9cef5aaa9b719d4b2b12d58b32f174edf7 (diff) | |
| download | efi-boot-shim-1eca363afe1e48f5aa1ee3c70f2042e9c511692e.tar.gz efi-boot-shim-1eca363afe1e48f5aa1ee3c70f2042e9c511692e.zip | |
mok import: handle OOM case
Coverity pointed out that AllocateZeroPool() can error, and then we
immediately dereference the NULL.
This handles the error case.
Signed-off-by: Peter Jones <pjones@redhat.com>
| -rw-r--r-- | mok.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -871,6 +871,10 @@ EFI_STATUS import_one_mok_state(struct mok_state_variable *v, if (efi_status == EFI_NOT_FOUND && v->flags & MOK_VARIABLE_INVERSE) { v->data = AllocateZeroPool(4); + if (!v->data) { + perror(L"Out of memory\n"); + return EFI_OUT_OF_RESOURCES; + } v->data[0] = 0x01; v->data_size = 1; } else if (efi_status == EFI_NOT_FOUND) { |
