Skip to content

Commit

Permalink
confile: use lxc_safe_u/int in config_init_{u,g}id
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
  • Loading branch information
Christian Brauner authored and stgraber committed Nov 22, 2016
1 parent 104b6a3 commit 64b7bd7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/lxc/confile.c
Expand Up @@ -1060,14 +1060,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;
}

Expand Down

0 comments on commit 64b7bd7

Please sign in to comment.