mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-06 16:13:35 +00:00
confile: Don't crash on invalid id_map
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
ff10044007
commit
7e60c3f0c1
@ -1300,13 +1300,10 @@ static int config_idmap(const char *key, const char *value, struct lxc_conf *lxc
|
||||
goto out;
|
||||
memset(idmap, 0, sizeof(*idmap));
|
||||
|
||||
idmaplist->elem = idmap;
|
||||
|
||||
lxc_list_add_tail(&lxc_conf->id_map, idmaplist);
|
||||
|
||||
ret = sscanf(value, "%c %lu %lu %lu", &type, &nsid, &hostid, &range);
|
||||
if (ret != 4)
|
||||
goto out;
|
||||
|
||||
INFO("read uid map: type %c nsid %lu hostid %lu range %lu", type, nsid, hostid, range);
|
||||
if (type == 'u')
|
||||
idmap->idtype = ID_TYPE_UID;
|
||||
@ -1314,10 +1311,14 @@ static int config_idmap(const char *key, const char *value, struct lxc_conf *lxc
|
||||
idmap->idtype = ID_TYPE_GID;
|
||||
else
|
||||
goto out;
|
||||
|
||||
idmap->hostid = hostid;
|
||||
idmap->nsid = nsid;
|
||||
idmap->range = range;
|
||||
|
||||
idmaplist->elem = idmap;
|
||||
lxc_list_add_tail(&lxc_conf->id_map, idmaplist);
|
||||
|
||||
return 0;
|
||||
|
||||
out:
|
||||
|
Loading…
Reference in New Issue
Block a user