Commit 856a5733 by Christian Brauner Committed by Stéphane Graber

conf/ile: use lxc_safe_uint() in config_autodev()

parent e245c633
...@@ -325,7 +325,7 @@ struct lxc_conf { ...@@ -325,7 +325,7 @@ struct lxc_conf {
scmp_filter_ctx seccomp_ctx; scmp_filter_ctx seccomp_ctx;
#endif #endif
int maincmd_fd; 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 haltsignal; // signal used to halt container
int rebootsignal; // signal used to reboot container int rebootsignal; // signal used to reboot container
int stopsignal; // signal used to hard stop container int stopsignal; // signal used to hard stop container
......
...@@ -1341,9 +1341,13 @@ static int config_loglevel(const char *key, const char *value, ...@@ -1341,9 +1341,13 @@ static int config_loglevel(const char *key, const char *value,
static int config_autodev(const char *key, const char *value, static int config_autodev(const char *key, const char *value,
struct lxc_conf *lxc_conf) 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; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment