mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-07 19:45:07 +02:00
MdeModulePkg/UdfDxe: Content check for 'File' in ResolveSymlink()
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1279 The content within 'File' is the output data for ResolveSymlink(). This commit will add checks to ensure the content in 'File' is valid. Otherwise, possible null pointer dereference issue will occur during the subsequent usage of the data returned by ResolveSymlink(). Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Paulo Alcantara <palcantara@suse.de> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
parent
542b03d0a0
commit
bfb8c64cbf
@ -2145,6 +2145,8 @@ ResolveSymlink (
|
||||
UINT8 CompressionId;
|
||||
UDF_FILE_INFO PreviousFile;
|
||||
|
||||
ZeroMem ((VOID *)File, sizeof (UDF_FILE_INFO));
|
||||
|
||||
//
|
||||
// Symlink files on UDF volumes do not contain so much data other than
|
||||
// Path Components which resolves to real filenames, so it's OK to read in
|
||||
@ -2288,6 +2290,14 @@ ResolveSymlink (
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Check the content in the file info pointed by File.
|
||||
//
|
||||
if ((File->FileEntry == NULL) || (File->FileIdentifierDesc == NULL)) {
|
||||
Status = EFI_VOLUME_CORRUPTED;
|
||||
goto Error_Find_File;
|
||||
}
|
||||
|
||||
if (CompareMem ((VOID *)&PreviousFile, (VOID *)Parent,
|
||||
sizeof (UDF_FILE_INFO)) != 0) {
|
||||
CleanupFileInformation (&PreviousFile);
|
||||
@ -2301,6 +2311,13 @@ ResolveSymlink (
|
||||
//
|
||||
FreePool (ReadFileInfo.FileData);
|
||||
|
||||
//
|
||||
// Check the content in the resolved file info.
|
||||
//
|
||||
if ((File->FileEntry == NULL) || (File->FileIdentifierDesc == NULL)) {
|
||||
return EFI_VOLUME_CORRUPTED;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
Error_Find_File:
|
||||
|
Loading…
x
Reference in New Issue
Block a user