7 Commits

Author SHA1 Message Date
Savva Mitrofanov
d24fd429be
Ext4Pkg: Code correctness and security improvements
Applies latest upstream changes, which performs minor changes into
previous patchset

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-02-16 21:20:02 +06:00
vit9696
8b6e67bcd9 Ext4Pkg: Filter out file names containing \0 as invalid
This patch improves checks added in 74135485.

Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
2023-01-12 13:31:47 +03:00
Savva Mitrofanov
504558b4ef
Ext4Pkg: Add missing exit Status in Ext4OpenDirent
Missing EFI_OUT_OF_RESOURCES exit status on failed Ext4CreateDentry
leads to NULL-pointer dereference in Ext4GetFileInfo (passing NULL
buffer in Ext4ReadDir)

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-08 22:07:11 +06:00
Savva Mitrofanov
17fa176e4d
Ext4Pkg: Add inode number validity check
We need to validate inode number to prevent possible null-pointer
dereference of directory parent in Ext4OpenDirent. Also checks that
inode number valid across opened partition before we read it in
Ext4ReadInode.

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:48:04 +06:00
Savva Mitrofanov
7413548584
Ext4Pkg: Fix global buffer overflow in Ext4ReadDir
Directory entry structure can contain name_len bigger than size of "."
or "..", that's why CompareMem in such cases leads to global buffer
overflow. So there are two problems. The first is that statement doesn't
check cases when name_len != 0 but > 2 and the second is that we passing
big Length to CompareMem routine.
The correct way here is to check that name_len <= 2 and check for
null-terminator presence

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:48:00 +06:00
Savva Mitrofanov
0c1c5a6ce1
Ext4Pkg: Fix memory leak in Ext4RetrieveDirent
We need to free buffer on return if BlockRemainder != 0. Also changed
return logic from function to use use common exit to prevent code
duplication.

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:47:58 +06:00
Savva Mitrofanov
03362e6d6f
Ext4Pkg: Add EDK II Ext4 package
Adds a Pedro Falcato's UEFI EXT4 filesystem driver that implements the EFI_FILE_PROTOCOL and EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2022-12-07 14:47:55 +06:00