summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2022-05-18 15:17:10 -0400
committerPeter Jones <pjones@redhat.com>2022-05-18 16:37:23 -0400
commit5868789a11bd5e85d1fae5fa9d9c28c3ef93dfb9 (patch)
treea002f16b18f25e37f15011c47fd255e7e8570f7a
parenta50d3645467fcfef970a00154d6d49494355afc9 (diff)
downloadefi-boot-shim-5868789a11bd5e85d1fae5fa9d9c28c3ef93dfb9.tar.gz
efi-boot-shim-5868789a11bd5e85d1fae5fa9d9c28c3ef93dfb9.zip
load_certs: trust dir->Read() slightly less.
scan-build says info->FileName returned from a successful call to dir->Read() can be NULL. I don't think that would be a compliant implementation, but anything's possible. This patch checks it for NULL-ness before the StrCaseCmp(). Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--shim.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/shim.c b/shim.c
index 80b11709..843cb374 100644
--- a/shim.c
+++ b/shim.c
@@ -1496,10 +1496,10 @@ load_certs(EFI_HANDLE image_handle)
goto done;
}
- if (buffersize == 0)
+ info = (EFI_FILE_INFO *)buffer;
+ if (buffersize == 0 || !info)
goto done;
- info = (EFI_FILE_INFO *)buffer;
if (StrnCaseCmp(info->FileName, L"shim_certificate", 16) == 0) {
load_cert_file(image_handle, info->FileName);
}