SecurityPkg: Add sanity check for File and FileBuffer inputs

Ensure that either File or FileBuffer is provided before proceeding with
security verification. If both are NULL, return EFI_INVALID_PARAMETER.
This prevents verification from running without a valid input buffer and
aligns with the intended design, where File is optional and FileBuffer
alone is sufficient.

Signed-off-by: Vignesh G <vigneshg@ami.com>
This commit is contained in:
Vignesh G 2026-06-17 13:22:43 +05:30 committed by mergify[bot]
parent 08258192d4
commit 56cad12011

View file

@ -1705,9 +1705,13 @@ DxeImageVerificationHandler (
IsFoundInDatabase = FALSE;
//
// Sanity check
// Sanity check:
// Ensure that either File or FileBuffer is provided.
// Return EFI_INVALID_PARAMETER if both are NULL.
// This prevents security verification from proceeding
// when no valid input buffer is available.
//
if (File == NULL) {
if ((File == NULL) && (FileBuffer == NULL)) {
return EFI_INVALID_PARAMETER;
}