Skip to content

Commit

Permalink
Merge pull request #1374 from brauner/2017-01-03/fix_suggest_default_…
Browse files Browse the repository at this point in the history
…idmap

conf: fix suggest_default_idmap()
  • Loading branch information
stgraber committed Jan 3, 2017
2 parents a87e4d0 + b793018 commit f290a80
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lxc/conf.c
Expand Up @@ -4514,6 +4514,7 @@ void suggest_default_idmap(void)
return;
}
while (getline(&line, &len, f) != -1) {
size_t no_newline = 0;
char *p = strchr(line, ':'), *p2;
if (*line == '#')
continue;
Expand All @@ -4530,6 +4531,9 @@ void suggest_default_idmap(void)
p2++;
if (!*p2)
continue;
no_newline = strcspn(p2, "\n");
p2[no_newline] = '\0';

if (lxc_safe_uint(p, &uid) < 0)
WARN("Could not parse UID.");
if (lxc_safe_uint(p2, &urange) < 0)
Expand All @@ -4545,6 +4549,7 @@ void suggest_default_idmap(void)
return;
}
while (getline(&line, &len, f) != -1) {
size_t no_newline = 0;
char *p = strchr(line, ':'), *p2;
if (*line == '#')
continue;
Expand All @@ -4561,6 +4566,9 @@ void suggest_default_idmap(void)
p2++;
if (!*p2)
continue;
no_newline = strcspn(p2, "\n");
p2[no_newline] = '\0';

if (lxc_safe_uint(p, &gid) < 0)
WARN("Could not parse GID.");
if (lxc_safe_uint(p2, &grange) < 0)
Expand Down

0 comments on commit f290a80

Please sign in to comment.