Hi,

had trouble getting the userspace cthelper for ftp working, tracked down the 
problem to incorrect length and incorrect params to nla_memcpy() when handling 
the helper's priv data in kernel.

--- net/netfilter/nfnetlink_cthelper.c.orig     2019-10-11 18:21:44.000000000 
+0200
+++ net/netfilter/nfnetlink_cthelper.c  2019-10-15 22:00:21.159986725 +0200
@@ -106,7 +106,7 @@ nfnl_cthelper_from_nlattr(struct nlattr
        if (help->helper->data_len == 0)
                return -EINVAL;

-       nla_memcpy(help->data, nla_data(attr), sizeof(help->data));
+       nla_memcpy(help->data, attr, help->helper->data_len);
        return 0;
 }

@@ -242,6 +242,7 @@ nfnl_cthelper_create(const struct nlattr
                ret = -ENOMEM;
                goto err2;
        }
+       helper->data_len = size;

        helper->flags |= NF_CT_HELPER_F_USERSPACE;
        memcpy(&helper->tuple, tuple, sizeof(struct nf_conntrack_tuple));

--

Regards
a_h

Reply via email to