-
-
Notifications
You must be signed in to change notification settings - Fork 180
Closed
Labels
Description
Per the EDK2 source for EFI_FILE_SYSTEM_INFO, our FileSystemInfo struct should have the following layout (as a rust structure):
#[repr(C)]
pub struct FileSystemInfo {
size: u64,
read_only: bool,
volume_size: u64,
free_space: u64,
block_size: u32,
name: [Char16],
}
However, as the uefi-rs code uses separate structs for the header and name components. This causes the name field to be misalligned, and the unsafe pointer arithmetic in the module to be wrong.
The result of this is that using volume_label()
field with FileSystemInfo
can perform an out of bounds read if the length is empty (unfortunately this is the default for mkfs.fat
), and it always returns an incorrect value for the label. Tested and confirmed on qemu-edk2 and a real system.