From c1a672afcb8ab477e201cee5cfc34c423cd05bf9 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Thu, 30 Oct 2025 23:25:48 -0400 Subject: [PATCH] fix(bootloader-interface): report the correct firmware revision --- src/integrations/bootloader_interface.rs | 11 +++++++---- src/utils/variables.rs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/integrations/bootloader_interface.rs b/src/integrations/bootloader_interface.rs index 7b3110d..31cfa5a 100644 --- a/src/integrations/bootloader_interface.rs +++ b/src/integrations/bootloader_interface.rs @@ -88,7 +88,7 @@ impl BootloaderInterface { // Write the bytes into the data buffer. data.extend_from_slice(&encoded); // Add a null terminator to the end of the entry. - data.push(0); + data.extend_from_slice(&[0, 0]); } Self::VENDOR.set( "LoaderEntries", @@ -117,12 +117,15 @@ impl BootloaderInterface { /// Tell the system about the UEFI firmware we are running on. pub fn set_firmware_info() -> Result<()> { + // Access the firmware revision. + let revision = uefi::system::firmware_revision(); + // Format the firmware information string into something human-readable. let firmware_info = format!( "{} {}.{:02}", uefi::system::firmware_vendor(), - uefi::system::firmware_revision() >> 16, - uefi::system::firmware_revision() & 0xFFFFF, + revision >> 16, + revision & 0xffff, ); Self::VENDOR.set_cstr16( "LoaderFirmwareInfo", @@ -131,7 +134,7 @@ impl BootloaderInterface { )?; // Format the firmware revision into something human-readable. - let firmware_type = format!("UEFI {:02}", uefi::system::firmware_revision()); + let firmware_type = format!("UEFI {}.{:02}", revision >> 16, revision & 0xffff); Self::VENDOR.set_cstr16( "LoaderFirmwareType", &firmware_type, diff --git a/src/utils/variables.rs b/src/utils/variables.rs index 38ae9c7..c80ab9a 100644 --- a/src/utils/variables.rs +++ b/src/utils/variables.rs @@ -89,7 +89,7 @@ impl VariableController { .flat_map(|c| c.to_le_bytes()) .collect::>(); // Add a null terminator to the end of the value. - encoded.push(0); + encoded.extend_from_slice(&[0, 0]); self.set(key, &encoded, class) }