From 7fe8120ecabd6305af130daf8d37881389079601 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Fri, 5 Feb 2021 11:59:14 +0100 Subject: [PATCH] confile: make garbage groups an error Signed-off-by: Christian Brauner --- src/lxc/confile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lxc/confile.c b/src/lxc/confile.c index f7ae28b03..8e1fb092e 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -1202,8 +1202,9 @@ static int set_config_init_groups(const char *key, const char *value, if (num_groups == INT_MAX) return log_error_errno(-ERANGE, ERANGE, "Excessive number of supplementary groups specified"); + /* This means the string wasn't empty and all we found was garbage. */ if (num_groups == 0) - return clr_config_init_groups(key, lxc_conf, NULL); + return log_error_errno(-EINVAL, EINVAL, "No valid groups specified %s", value); idx = lxc_conf->init_groups.size; init_groups = realloc(lxc_conf->init_groups.list, sizeof(gid_t) * (idx + num_groups)); @@ -1227,7 +1228,7 @@ static int set_config_init_groups(const char *key, const char *value, ret = lxc_safe_uint(token, &group); if (ret) - return ret; + return log_error_errno(ret, -ret, "Failed to parse group %s", token); init_groups[idx++] = group; } -- 2.47.2