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

index f848c5772a6e2bba996d4bda95ea52b59b24c8ef..156b67372ecaf21c1fcb0ed910dc44f82efdf9f3 100644 (file)
@@ -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;
index c24663e48ce19a4daae33280c2ffd2cd3eb0d8c4..72d46609bccd0205a1a234042a91f9982d3c90c5 100644 (file)
@@ -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);