Skip to content

Commit

Permalink
AdvLoggerPkg: Exit from write call if signature mismatch (#565)
Browse files Browse the repository at this point in the history
## Description

Current behavior allows the PPI to be used if there is a signature or
version mismatch. This fix returns from the function to exit gracefully
and prevent memory corruption.

Created a bug to track this behavior elsewhere in Advanced Logger
Library: #567

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?

## How This Was Tested

Local CI and unit test.

## Integration Instructions

N/A
  • Loading branch information
VivianNK authored Aug 28, 2024
1 parent b5632fc commit bde9c52
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions AdvLoggerPkg/Library/AdvancedLoggerLib/Pei/AdvancedLoggerLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,15 @@ AdvancedLoggerWrite (
);

if (Status == EFI_SUCCESS) {
ASSERT (AdvancedLoggerPpi->Signature == ADVANCED_LOGGER_PPI_SIGNATURE);
ASSERT (AdvancedLoggerPpi->Version == ADVANCED_LOGGER_PPI_VERSION);
if ((AdvancedLoggerPpi->Signature != ADVANCED_LOGGER_PPI_SIGNATURE) ||
(AdvancedLoggerPpi->Version != ADVANCED_LOGGER_PPI_VERSION))
{
ASSERT (AdvancedLoggerPpi->Signature == ADVANCED_LOGGER_PPI_SIGNATURE);
ASSERT (AdvancedLoggerPpi->Version == ADVANCED_LOGGER_PPI_VERSION);

// Signature/Version mismatch, don't attempt to use the PPI.
return;
}

AdvancedLoggerPpi->AdvancedLoggerWritePpi (ErrorLevel, Buffer, NumberOfBytes);
}
Expand Down

0 comments on commit bde9c52

Please sign in to comment.