mirror of
https://github.com/acidanthera/audk.git
synced 2025-09-25 10:47:47 +02:00
Ext4Pkg: Check VolumeName allocation correctness in Ext4GetVolumeName
Missing check in some cases leads to failed StrCpyS call in Ext4GetVolumeLabelInfo. Also correct condition that checks Inode pointer for being NULL in Ext4AllocateInode Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
This commit is contained in:
parent
8f4875d7b5
commit
b4077c6f4f
@ -726,7 +726,11 @@ Ext4GetVolumeName (
|
|||||||
|
|
||||||
VolNameLength = StrLen (VolumeName);
|
VolNameLength = StrLen (VolumeName);
|
||||||
} else {
|
} else {
|
||||||
VolumeName = AllocateZeroPool (sizeof (CHAR16));
|
VolumeName = AllocateZeroPool (sizeof (CHAR16));
|
||||||
|
if (VolumeName == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
VolNameLength = 0;
|
VolNameLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -793,7 +797,9 @@ Ext4GetFilesystemInfo (
|
|||||||
Info->VolumeSize = MultU64x32 (TotalBlocks, Part->BlockSize);
|
Info->VolumeSize = MultU64x32 (TotalBlocks, Part->BlockSize);
|
||||||
Info->FreeSpace = MultU64x32 (FreeBlocks, Part->BlockSize);
|
Info->FreeSpace = MultU64x32 (FreeBlocks, Part->BlockSize);
|
||||||
|
|
||||||
StrCpyS (Info->VolumeLabel, VolNameLength + 1, VolumeName);
|
Status = StrCpyS (Info->VolumeLabel, VolNameLength + 1, VolumeName);
|
||||||
|
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
FreePool (VolumeName);
|
FreePool (VolumeName);
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ Ext4AllocateInode (
|
|||||||
|
|
||||||
Inode = AllocateZeroPool (InodeSize);
|
Inode = AllocateZeroPool (InodeSize);
|
||||||
|
|
||||||
if (!Inode) {
|
if (Inode == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user