lwext4_fs: use copy_cstring, update Xml_node use
Issue genodelabs/genode#3752 Issue genodelabs/genode#3755
This commit is contained in:
@@ -103,7 +103,7 @@ class Lwext4_fs::Directory : public Node
|
|||||||
|
|
||||||
size_t const len = (size_t)(dentry->name_length + 1) > sizeof(e->name)
|
size_t const len = (size_t)(dentry->name_length + 1) > sizeof(e->name)
|
||||||
? sizeof(e->name) : dentry->name_length + 1;
|
? sizeof(e->name) : dentry->name_length + 1;
|
||||||
strncpy(e->name.buf, reinterpret_cast<char const*>(dentry->name), len);
|
copy_cstring(e->name.buf, reinterpret_cast<char const*>(dentry->name), len);
|
||||||
|
|
||||||
e->inode = dentry->inode;
|
e->inode = dentry->inode;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -589,15 +589,15 @@ class Lwext4_fs::Root : public Root_component<Session_component>
|
|||||||
}
|
}
|
||||||
ram_quota -= session_size;
|
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 */
|
/* determine policy root offset */
|
||||||
try {
|
{
|
||||||
policy.attribute("root").value(tmp, sizeof(tmp));
|
typedef String<MAX_PATH_LEN> Tmp;
|
||||||
session_root.import(tmp, "/mnt");
|
Tmp const tmp = policy.attribute_value("root", Tmp());
|
||||||
} catch (Xml_node::Nonexistent_attribute) { }
|
if (tmp.valid())
|
||||||
|
session_root.import(tmp.string(), "/mnt");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine if the session is writeable.
|
* Determine if the session is writeable.
|
||||||
@@ -605,15 +605,16 @@ class Lwext4_fs::Root : public Root_component<Session_component>
|
|||||||
*/
|
*/
|
||||||
if (policy.attribute_value("writeable", false))
|
if (policy.attribute_value("writeable", false))
|
||||||
writeable = Arg_string::find_arg(args, "writeable").bool_value(false);
|
writeable = Arg_string::find_arg(args, "writeable").bool_value(false);
|
||||||
}
|
|
||||||
catch (Session_policy::No_policy_defined) { throw Service_denied(); }
|
|
||||||
|
|
||||||
/* apply client's root offset */
|
/* apply client's root offset */
|
||||||
|
{
|
||||||
|
char tmp[MAX_PATH_LEN];
|
||||||
Arg_string::find_arg(args, "root").string(tmp, sizeof(tmp), "/");
|
Arg_string::find_arg(args, "root").string(tmp, sizeof(tmp), "/");
|
||||||
if (Genode::strcmp("/", tmp, sizeof(tmp))) {
|
if (Genode::strcmp("/", tmp, sizeof(tmp))) {
|
||||||
session_root.append("/");
|
session_root.append("/");
|
||||||
session_root.append(tmp);
|
session_root.append(tmp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
session_root.remove_trailing('/');
|
session_root.remove_trailing('/');
|
||||||
|
|
||||||
char const *root_dir = session_root.base();
|
char const *root_dir = session_root.base();
|
||||||
|
|||||||
Reference in New Issue
Block a user