mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 08:35:19 -05:00
netfilter: x_tables: check name length in find_match/target, too
ebtables uses find_match() rather than find_request_match in one case
(see bcf4934288
,
"netfilter: ebtables: Fix extension lookup with identical name"), so
extend the check on name length to those functions too.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
72d4d3e398
commit
dceb48d86b
1 changed files with 6 additions and 0 deletions
|
@ -183,6 +183,9 @@ struct xt_match *xt_find_match(u8 af, const char *name, u8 revision)
|
|||
struct xt_match *m;
|
||||
int err = -ENOENT;
|
||||
|
||||
if (strnlen(name, XT_EXTENSION_MAXNAMELEN) == XT_EXTENSION_MAXNAMELEN)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
mutex_lock(&xt[af].mutex);
|
||||
list_for_each_entry(m, &xt[af].match, list) {
|
||||
if (strcmp(m->name, name) == 0) {
|
||||
|
@ -229,6 +232,9 @@ struct xt_target *xt_find_target(u8 af, const char *name, u8 revision)
|
|||
struct xt_target *t;
|
||||
int err = -ENOENT;
|
||||
|
||||
if (strnlen(name, XT_EXTENSION_MAXNAMELEN) == XT_EXTENSION_MAXNAMELEN)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
mutex_lock(&xt[af].mutex);
|
||||
list_for_each_entry(t, &xt[af].target, list) {
|
||||
if (strcmp(t->name, name) == 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue