From 51e6aee2361a83239cce26cd0bb7aca9a1e3b995 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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/arch/x86_64/firecracker.rs b/src/arch/x86_64/firecracker.rs index 6110d31..85490e9 100644 --- a/src/arch/x86_64/firecracker.rs +++ b/src/arch/x86_64/firecracker.rs @@ -144,7 +144,16 @@ 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 };