From: Christian Brauner Date: Fri, 28 Oct 2016 18:08:12 +0000 (+0200) Subject: conf/ile: use lxc_safe_uint() in config_kmsg() X-Git-Tag: lxc-2.1.0~257^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91863d360bea96e2ff2f52f38c8a735291adadf4;p=thirdparty%2Flxc.git conf/ile: use lxc_safe_uint() in config_kmsg() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.h b/src/lxc/conf.h index 4fd5b108a..6f40259eb 100644 --- a/src/lxc/conf.h +++ b/src/lxc/conf.h @@ -329,7 +329,7 @@ struct lxc_conf { int haltsignal; // signal used to halt container int rebootsignal; // signal used to reboot container int stopsignal; // signal used to hard stop container - int kmsg; // if 1, create /dev/kmsg symlink + unsigned int kmsg; // if 1, create /dev/kmsg symlink char *rcfile; // Copy of the top level rcfile we read // Logfile and logleve can be set in a container config file. diff --git a/src/lxc/confile.c b/src/lxc/confile.c index b6d5af001..a9f8a74a1 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -1275,9 +1275,11 @@ static int config_ttydir(const char *key, const char *value, static int config_kmsg(const char *key, const char *value, struct lxc_conf *lxc_conf) { - int v = atoi(value); + if (lxc_safe_uint(value, &lxc_conf->kmsg) < 0) + return -1; - lxc_conf->kmsg = v; + if (lxc_conf->kmsg > 1) + return -1; return 0; }