2
0
mirror of git://github.com/lxc/lxc synced 2025-08-29 18:39:50 +00:00

confile: use lxc_safe_u/int in config_init_{u,g}id

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
This commit is contained in:
Christian Brauner 2016-10-28 19:53:19 +02:00
parent 1c6333988f
commit d1e5d63673
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -1065,14 +1065,24 @@ static int config_init_cmd(const char *key, const char *value,
static int config_init_uid(const char *key, const char *value,
struct lxc_conf *lxc_conf)
{
lxc_conf->init_uid = atoi(value);
unsigned int init_uid;
if (lxc_safe_uint(value, &init_uid) < 0)
return -1;
lxc_conf->init_uid = init_uid;
return 0;
}
static int config_init_gid(const char *key, const char *value,
struct lxc_conf *lxc_conf)
{
lxc_conf->init_gid = atoi(value);
unsigned int init_gid;
if (lxc_safe_uint(value, &init_gid) < 0)
return -1;
lxc_conf->init_gid = init_gid;
return 0;
}