mirror of
git://github.com/lxc/lxc
synced 2025-09-03 19:39:33 +00:00
Merge pull request #3735 from brauner/2021-03-26/fixes_2
oss-fuzz: fixes
This commit is contained in:
@@ -3742,7 +3742,7 @@ int lxc_clear_limits(struct lxc_conf *c, const char *key)
|
|||||||
else if (strnequal(key, "lxc.prlimit.", STRLITERALLEN("lxc.prlimit.")))
|
else if (strnequal(key, "lxc.prlimit.", STRLITERALLEN("lxc.prlimit.")))
|
||||||
k = key + STRLITERALLEN("lxc.prlimit.");
|
k = key + STRLITERALLEN("lxc.prlimit.");
|
||||||
else
|
else
|
||||||
return -1;
|
return ret_errno(EINVAL);
|
||||||
|
|
||||||
lxc_list_for_each_safe (it, &c->limits, next) {
|
lxc_list_for_each_safe (it, &c->limits, next) {
|
||||||
struct lxc_limit *lim = it->elem;
|
struct lxc_limit *lim = it->elem;
|
||||||
@@ -3751,11 +3751,14 @@ int lxc_clear_limits(struct lxc_conf *c, const char *key)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
lxc_list_del(it);
|
lxc_list_del(it);
|
||||||
free(lim->resource);
|
|
||||||
|
free_disarm(lim->resource);
|
||||||
free(lim);
|
free(lim);
|
||||||
free(it);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (all)
|
||||||
|
lxc_list_init(&c->limits);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2667,6 +2667,10 @@ static int set_config_rootfs_options(const char *key, const char *value,
|
|||||||
struct lxc_rootfs *rootfs = &lxc_conf->rootfs;
|
struct lxc_rootfs *rootfs = &lxc_conf->rootfs;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
clr_config_rootfs_options(key, lxc_conf, data);
|
||||||
|
if (lxc_config_value_empty(value))
|
||||||
|
return 0;
|
||||||
|
|
||||||
ret = parse_mntopts(value, &mflags, &mdata);
|
ret = parse_mntopts(value, &mflags, &mdata);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret_errno(EINVAL);
|
return ret_errno(EINVAL);
|
||||||
|
@@ -1024,17 +1024,31 @@ static int sig_num(const char *sig)
|
|||||||
|
|
||||||
static int rt_sig_num(const char *signame)
|
static int rt_sig_num(const char *signame)
|
||||||
{
|
{
|
||||||
int rtmax = 0, sig_n = 0;
|
bool rtmax;
|
||||||
|
int sig_n = 0;
|
||||||
|
|
||||||
if (strncasecmp(signame, "max-", 4) == 0)
|
if (is_empty_string(signame))
|
||||||
rtmax = 1;
|
return ret_errno(EINVAL);
|
||||||
|
|
||||||
signame += 4;
|
if (strncasecmp(signame, "max-", STRLITERALLEN("max-")) == 0) {
|
||||||
if (!isdigit(*signame))
|
rtmax = true;
|
||||||
|
signame += STRLITERALLEN("max-");
|
||||||
|
} else if (strncasecmp(signame, "min+", STRLITERALLEN("min+")) == 0) {
|
||||||
|
rtmax = false;
|
||||||
|
signame += STRLITERALLEN("min+");
|
||||||
|
} else {
|
||||||
|
return ret_errno(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_empty_string(signame) || !isdigit(*signame))
|
||||||
return ret_errno(EINVAL);
|
return ret_errno(EINVAL);
|
||||||
|
|
||||||
sig_n = sig_num(signame);
|
sig_n = sig_num(signame);
|
||||||
sig_n = rtmax ? SIGRTMAX - sig_n : SIGRTMIN + sig_n;
|
if (rtmax)
|
||||||
|
sig_n = SIGRTMAX - sig_n;
|
||||||
|
else
|
||||||
|
sig_n = SIGRTMIN + sig_n;
|
||||||
|
|
||||||
if (sig_n > SIGRTMAX || sig_n < SIGRTMIN)
|
if (sig_n > SIGRTMAX || sig_n < SIGRTMIN)
|
||||||
return ret_errno(EINVAL);
|
return ret_errno(EINVAL);
|
||||||
|
|
||||||
@@ -1043,16 +1057,15 @@ static int rt_sig_num(const char *signame)
|
|||||||
|
|
||||||
int sig_parse(const char *signame)
|
int sig_parse(const char *signame)
|
||||||
{
|
{
|
||||||
size_t n;
|
if (isdigit(*signame))
|
||||||
|
|
||||||
if (isdigit(*signame)) {
|
|
||||||
return sig_num(signame);
|
return sig_num(signame);
|
||||||
} else if (strncasecmp(signame, "sig", 3) == 0) {
|
|
||||||
signame += 3;
|
|
||||||
if (strncasecmp(signame, "rt", 2) == 0)
|
|
||||||
return rt_sig_num(signame + 2);
|
|
||||||
|
|
||||||
for (n = 0; n < sizeof(signames) / sizeof((signames)[0]); n++)
|
if (strncasecmp(signame, "sig", STRLITERALLEN("sig")) == 0) {
|
||||||
|
signame += STRLITERALLEN("sig");
|
||||||
|
if (strncasecmp(signame, "rt", STRLITERALLEN("rt")) == 0)
|
||||||
|
return rt_sig_num(signame + STRLITERALLEN("rt"));
|
||||||
|
|
||||||
|
for (size_t n = 0; n < ARRAY_SIZE(signames); n++)
|
||||||
if (strcasecmp(signames[n].name, signame) == 0)
|
if (strcasecmp(signames[n].name, signame) == 0)
|
||||||
return signames[n].num;
|
return signames[n].num;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user