Only accept UTF-8 directory entries

This commit is contained in:
topjohnwu
2025-04-15 00:19:28 -07:00
committed by John Wu
parent 92a42d901f
commit 7a207d4ccf
7 changed files with 50 additions and 55 deletions

View File

@@ -164,10 +164,8 @@ pub fn persist_get_props(mut prop_cb: Pin<&mut PropCb>) {
let mut dir = Directory::open(cstr!(PERSIST_PROP_DIR))?;
dir.pre_order_walk(|e| {
if e.is_file() {
if let Ok(name) = Utf8CStr::from_cstr(e.name()) {
if let Ok(mut value) = file_get_prop(name) {
prop_cb.exec(name, Utf8CStr::from_string(&mut value));
}
if let Ok(mut value) = file_get_prop(e.name()) {
prop_cb.exec(e.name(), Utf8CStr::from_string(&mut value));
}
}
// Do not traverse recursively