Commit 703acd70 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nfnetlink_cthelper: unbreak userspace helper support

Restore helper data size initialization and fix memcopy of the helper
data size.

Fixes: 157ffffe ("netfilter: nfnetlink_cthelper: reject too large userspace allocation requests")
Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent ee04805f
...@@ -103,7 +103,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct) ...@@ -103,7 +103,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct)
if (help->helper->data_len == 0) if (help->helper->data_len == 0)
return -EINVAL; return -EINVAL;
nla_memcpy(help->data, nla_data(attr), sizeof(help->data)); nla_memcpy(help->data, attr, sizeof(help->data));
return 0; return 0;
} }
...@@ -240,6 +240,7 @@ nfnl_cthelper_create(const struct nlattr * const tb[], ...@@ -240,6 +240,7 @@ nfnl_cthelper_create(const struct nlattr * const tb[],
ret = -ENOMEM; ret = -ENOMEM;
goto err2; goto err2;
} }
helper->data_len = size;
helper->flags |= NF_CT_HELPER_F_USERSPACE; helper->flags |= NF_CT_HELPER_F_USERSPACE;
memcpy(&helper->tuple, tuple, sizeof(struct nf_conntrack_tuple)); memcpy(&helper->tuple, tuple, sizeof(struct nf_conntrack_tuple));
......
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