diff --git a/src/server/lwext4_fs/directory.h b/src/server/lwext4_fs/directory.h index c419a9d..9896f18 100644 --- a/src/server/lwext4_fs/directory.h +++ b/src/server/lwext4_fs/directory.h @@ -103,7 +103,7 @@ class Lwext4_fs::Directory : public Node size_t const len = (size_t)(dentry->name_length + 1) > sizeof(e->name) ? sizeof(e->name) : dentry->name_length + 1; - strncpy(e->name.buf, reinterpret_cast(dentry->name), len); + copy_cstring(e->name.buf, reinterpret_cast(dentry->name), len); e->inode = dentry->inode; break; diff --git a/src/server/lwext4_fs/main.cc b/src/server/lwext4_fs/main.cc index bfa318a..cab77eb 100644 --- a/src/server/lwext4_fs/main.cc +++ b/src/server/lwext4_fs/main.cc @@ -589,30 +589,31 @@ class Lwext4_fs::Root : public Root_component } ram_quota -= session_size; - char tmp[MAX_PATH_LEN]; - try { - Session_policy policy(label, _config_rom.xml()); + Session_policy policy(label, _config_rom.xml()); - /* determine policy root offset */ - try { - policy.attribute("root").value(tmp, sizeof(tmp)); - session_root.import(tmp, "/mnt"); - } catch (Xml_node::Nonexistent_attribute) { } - - /* - * Determine if the session is writeable. - * Policy overrides client argument, both default to false. - */ - if (policy.attribute_value("writeable", false)) - writeable = Arg_string::find_arg(args, "writeable").bool_value(false); + /* determine policy root offset */ + { + typedef String Tmp; + Tmp const tmp = policy.attribute_value("root", Tmp()); + if (tmp.valid()) + session_root.import(tmp.string(), "/mnt"); } - catch (Session_policy::No_policy_defined) { throw Service_denied(); } + + /* + * Determine if the session is writeable. + * Policy overrides client argument, both default to false. + */ + if (policy.attribute_value("writeable", false)) + writeable = Arg_string::find_arg(args, "writeable").bool_value(false); /* apply client's root offset */ - Arg_string::find_arg(args, "root").string(tmp, sizeof(tmp), "/"); - if (Genode::strcmp("/", tmp, sizeof(tmp))) { - session_root.append("/"); - session_root.append(tmp); + { + char tmp[MAX_PATH_LEN]; + Arg_string::find_arg(args, "root").string(tmp, sizeof(tmp), "/"); + if (Genode::strcmp("/", tmp, sizeof(tmp))) { + session_root.append("/"); + session_root.append(tmp); + } } session_root.remove_trailing('/');