From b0afe953595f65c3277a4ffe2a8f13aa6b548601 Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Mon, 9 Dec 2024 00:25:57 +0100 Subject: [PATCH] fix(uhyve): fix improper unlink string handling --- src/fs/uhyve.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fs/uhyve.rs b/src/fs/uhyve.rs index e71aeb4b46..817e7e523f 100644 --- a/src/fs/uhyve.rs +++ b/src/fs/uhyve.rs @@ -286,13 +286,16 @@ impl VfsNode for UhyveDirectory { fn traverse_unlink(&self, components: &mut Vec<&str>) -> io::Result<()> { let path: String = if components.is_empty() { - "/".to_string() + "/\0".to_string() } else { - components + let mut path: String = components .iter() .rev() .map(|v| "/".to_owned() + v) - .collect() + .collect(); + path.push('\0'); + path.remove(0); + path }; let mut sysunlink = SysUnlink::new(VirtAddr::from_ptr(path.as_ptr()));