From dc5abe1ee8d85cda805e5b79ae687675ae95c266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Sat, 16 Nov 2024 12:50:49 +0100 Subject: [PATCH] fix(firecracker): remove trailing null from bootargs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- src/arch/x86_64/firecracker.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/arch/x86_64/firecracker.rs b/src/arch/x86_64/firecracker.rs index 6110d314..f0f8af07 100644 --- a/src/arch/x86_64/firecracker.rs +++ b/src/arch/x86_64/firecracker.rs @@ -144,7 +144,13 @@ pub unsafe fn boot_kernel(kernel_info: LoadedKernel) -> ! { ) }; - Some(core::str::from_utf8(slice).unwrap()) + let s = core::str::from_utf8(slice).unwrap().strip_suffix('\0').unwrap(); + + if s.is_empty() { + None + } else { + Some(s) + } } else { None };