From 226dc30e4f007f1eb328c4ce882fc42fd504ef19 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Fri, 28 Oct 2016 20:05:07 +0200 Subject: [PATCH] conf/ile: use lxc_safe_uint() in config_monitor() Signed-off-by: Christian Brauner --- src/lxc/conf.h | 2 +- src/lxc/confile.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lxc/conf.h b/src/lxc/conf.h index 156b67372..3a23f55a1 100644 --- a/src/lxc/conf.h +++ b/src/lxc/conf.h @@ -350,7 +350,7 @@ struct lxc_conf { int nbd_idx; /* unshare the mount namespace in the monitor */ - int monitor_unshare; + unsigned int monitor_unshare; /* set to true when rootfs has been setup */ bool rootfs_setup; diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 72d46609b..614baacf6 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -1176,7 +1176,8 @@ static int config_monitor(const char *key, const char *value, struct lxc_conf *lxc_conf) { if(strcmp(key, "lxc.monitor.unshare") == 0) { - lxc_conf->monitor_unshare = atoi(value); + if (lxc_safe_uint(value, &lxc_conf->monitor_unshare) < 0) + return -1; return 0; } SYSERROR("Unknown key: %s", key);