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

index 4fd5b108a7fafaa6f8b73717e4c0d07f5999ab54..6f40259eb9eff69d5ddf03634374eb8d2a48aba1 100644 (file)
@@ -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.
index b6d5af001583d048f4135c9d99b04521c134452d..a9f8a74a1196962005335a6b6280b9d9f1454d63 100644 (file)
@@ -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;
 }