MdeModulePkg: FvSimpleFileSystemDxe cumulative codeql issues.

Running Codeql on MdeModulePkg/Universal/FvSimpleFileSystemDxe drivers results
in codeql errors stemming from missing null tests.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>

Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
Co-authored-by: Taylor Beebe <tabeebe@microsoft.com>
Co-authored-by: pohanch <125842322+pohanch@users.noreply.github.com>
Co-authored-by: kenlautner <85201046+kenlautner@users.noreply.github.com>
Co-authored-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Co-authored-by: Sean Brogan <sean.brogan@microsoft.com>
Co-authored-by: Aaron <aaronpop@microsoft>
This commit is contained in:
Michael Kubacki 2025-05-12 16:33:13 -07:00 committed by Liming Gao
parent 4cb3e8d467
commit cb85c4deef
2 changed files with 8 additions and 1 deletions

View file

@ -562,6 +562,10 @@ FvSimpleFileSystemOpen (
// NewFileNameLength = FileNameLength + 1 + 4 = (Number of non-null character) + (file extension) + (a null character)
NewFileNameLength = FileNameLength + 1 + 4;
FileNameWithExtension = AllocatePool (NewFileNameLength * 2);
if (FileNameWithExtension == NULL) {
return EFI_OUT_OF_RESOURCES;
}
StrCpyS (FileNameWithExtension, NewFileNameLength, FileName);
StrCatS (FileNameWithExtension, NewFileNameLength, L".EFI");