]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf/ile: use lxc_safe_uint() in config_autodev()
authorChristian Brauner <christian.brauner@canonical.com>
Fri, 28 Oct 2016 18:22:35 +0000 (20:22 +0200)
committerChristian Brauner <christian.brauner@canonical.com>
Tue, 22 Nov 2016 03:41:37 +0000 (04:41 +0100)
Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
src/lxc/conf.h
src/lxc/confile.c

index 6532d8e271d9cafa22522b9b2fcad9fcc3224c0e..283042c782b7bfdaadcbb894040f6f90d0ae8d2a 100644 (file)
@@ -325,7 +325,7 @@ struct lxc_conf {
        scmp_filter_ctx seccomp_ctx;
 #endif
        int maincmd_fd;
-       int autodev;  // if 1, mount and fill a /dev at start
+       unsigned int autodev;  // if 1, mount and fill a /dev at start
        int haltsignal; // signal used to halt container
        int rebootsignal; // signal used to reboot container
        int stopsignal; // signal used to hard stop container
index 331a36dd9d5973ca7b08d62690bc204b12bddb35..dad7a73f3581926354ba9c0938d3eb92fe4f7603 100644 (file)
@@ -1346,9 +1346,13 @@ static int config_loglevel(const char *key, const char *value,
 static int config_autodev(const char *key, const char *value,
                          struct lxc_conf *lxc_conf)
 {
-       int v = atoi(value);
+       if (lxc_safe_uint(value, &lxc_conf->autodev) < 0)
+               return -1;
 
-       lxc_conf->autodev = v;
+       if (lxc_conf->autodev > 1) {
+               ERROR("Wrong value for lxc.autodev. Can only be set to 0 or 1");
+               return -1;
+       }
 
        return 0;
 }