MdeModulePkg: PiSmmIpl: Add check for MM communicate v3 header

This change adds a check to ensure the incoming buffer is correctly using
MM communicate v3 header before dereferencing the content.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
This commit is contained in:
Kun Qin
2025-05-13 15:30:02 -07:00
committed by mergify[bot]
parent 9752e69927
commit fdb638fc28

View File

@@ -737,6 +737,13 @@ MmCommunicationMmCommunicate3 (
}
CommunicateHeader = (EFI_MM_COMMUNICATE_HEADER_V3 *)CommBufferVirtual;
if (!CompareGuid (
&CommunicateHeader->HeaderGuid,
&gEfiMmCommunicateHeaderV3Guid
))
{
return EFI_INVALID_PARAMETER;
}
Status = SafeUint64Add (sizeof (EFI_MM_COMMUNICATE_HEADER_V3), CommunicateHeader->MessageSize, &MinCommSize);
if (EFI_ERROR (Status)) {