mirror of
git://github.com/lxc/lxc
synced 2025-08-31 11:09: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.")))
|
||||
k = key + STRLITERALLEN("lxc.prlimit.");
|
||||
else
|
||||
return -1;
|
||||
return ret_errno(EINVAL);
|
||||
|
||||
lxc_list_for_each_safe (it, &c->limits, next) {
|
||||
struct lxc_limit *lim = it->elem;
|
||||
@@ -3751,11 +3751,14 @@ int lxc_clear_limits(struct lxc_conf *c, const char *key)
|
||||
continue;
|
||||
|
||||
lxc_list_del(it);
|
||||
free(lim->resource);
|
||||
|
||||
free_disarm(lim->resource);
|
||||
free(lim);
|
||||
free(it);
|
||||
}
|
||||
|
||||
if (all)
|
||||
lxc_list_init(&c->limits);
|
||||
|
||||
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;
|
||||
int ret;
|
||||
|
||||
clr_config_rootfs_options(key, lxc_conf, data);
|
||||
if (lxc_config_value_empty(value))
|
||||
return 0;
|
||||
|
||||
ret = parse_mntopts(value, &mflags, &mdata);
|
||||
if (ret < 0)
|
||||
return ret_errno(EINVAL);
|
||||
@@ -2679,9 +2683,9 @@ static int set_config_rootfs_options(const char *key, const char *value,
|
||||
if (ret < 0)
|
||||
return ret_errno(ENOMEM);
|
||||
|
||||
rootfs->mountflags = mflags | pflags;
|
||||
rootfs->options = move_ptr(opts);
|
||||
rootfs->data = move_ptr(mdata);
|
||||
rootfs->mountflags = mflags | pflags;
|
||||
rootfs->options = move_ptr(opts);
|
||||
rootfs->data = move_ptr(mdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1024,17 +1024,31 @@ static int sig_num(const char *sig)
|
||||
|
||||
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)
|
||||
rtmax = 1;
|
||||
if (is_empty_string(signame))
|
||||
return ret_errno(EINVAL);
|
||||
|
||||
signame += 4;
|
||||
if (!isdigit(*signame))
|
||||
if (strncasecmp(signame, "max-", STRLITERALLEN("max-")) == 0) {
|
||||
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);
|
||||
|
||||
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)
|
||||
return ret_errno(EINVAL);
|
||||
|
||||
@@ -1043,16 +1057,15 @@ static int rt_sig_num(const char *signame)
|
||||
|
||||
int sig_parse(const char *signame)
|
||||
{
|
||||
size_t n;
|
||||
|
||||
if (isdigit(*signame)) {
|
||||
if (isdigit(*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)
|
||||
return signames[n].num;
|
||||
}
|
||||
|
Reference in New Issue
Block a user