From: Christian Brauner Date: Fri, 28 Oct 2016 18:01:21 +0000 (+0200) Subject: conf/ile: use lxc_safe_u/int() in config_start() X-Git-Tag: lxc-2.1.0~257^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3590152f01a8e1d4ce36073707f19333fc686c50;p=thirdparty%2Flxc.git conf/ile: use lxc_safe_u/int() in config_start() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.h b/src/lxc/conf.h index f848c5772..156b67372 100644 --- a/src/lxc/conf.h +++ b/src/lxc/conf.h @@ -343,8 +343,8 @@ struct lxc_conf { int inherit_ns_fd[LXC_NS_MAX]; - int start_auto; - int start_delay; + unsigned int start_auto; + unsigned int start_delay; int start_order; struct lxc_list groups; int nbd_idx; diff --git a/src/lxc/confile.c b/src/lxc/confile.c index c24663e48..72d46609b 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -1152,15 +1152,20 @@ static int config_start(const char *key, const char *value, struct lxc_conf *lxc_conf) { if(strcmp(key, "lxc.start.auto") == 0) { - lxc_conf->start_auto = atoi(value); + if (lxc_safe_uint(value, &lxc_conf->start_auto) < 0) + return -1; + if (lxc_conf->start_auto > 1) + return -1; return 0; } else if (strcmp(key, "lxc.start.delay") == 0) { - lxc_conf->start_delay = atoi(value); + if (lxc_safe_uint(value, &lxc_conf->start_delay) < 0) + return -1; return 0; } else if (strcmp(key, "lxc.start.order") == 0) { - lxc_conf->start_order = atoi(value); + if (lxc_safe_int(value, &lxc_conf->start_order) < 0) + return -1; return 0; } SYSERROR("Unknown key: %s", key);