mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-02 08:42:52 +00:00
Noux: simplify 'User_info' constructor
This patch removes the '_dup_str' function, which was unsafe due to a missing check of the dst boundary.
This commit is contained in:
parent
95f4b24f30
commit
5a1c47e943
@ -23,33 +23,24 @@
|
|||||||
|
|
||||||
namespace Noux {
|
namespace Noux {
|
||||||
|
|
||||||
|
using namespace Genode;
|
||||||
|
|
||||||
struct User_info {
|
struct User_info {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
char name[Sysio::MAX_USERNAME_LEN];
|
char name[Sysio::MAX_USERNAME_LEN];
|
||||||
char shell[Sysio::MAX_SHELL_LEN];
|
char shell[Sysio::MAX_SHELL_LEN];
|
||||||
char home[Sysio::MAX_HOME_LEN];
|
char home[Sysio::MAX_HOME_LEN];
|
||||||
|
|
||||||
unsigned int uid;
|
unsigned int uid;
|
||||||
unsigned int gid;
|
unsigned int gid;
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void _dup_str(char *dest, const char *src)
|
|
||||||
{
|
|
||||||
Genode::size_t len = Genode::strlen(src);
|
|
||||||
Genode::memcpy(dest, src, len);
|
|
||||||
dest[len] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
User_info() : uid(0), gid(0)
|
User_info() : uid(0), gid(0)
|
||||||
{
|
{
|
||||||
_dup_str(name, "root");
|
strncpy(name, "root", sizeof(name));
|
||||||
_dup_str(home, "/");
|
strncpy(home, "/", sizeof(home));
|
||||||
_dup_str(shell, "/bin/bash");
|
strncpy(shell, "/bin/bash", sizeof(shell));
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_info(Genode::Xml_node user_info_node)
|
void set_info(Genode::Xml_node user_info_node)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user