netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages
authorDaniel Borkmann <dborkman@redhat.com>
Sun, 5 Jan 2014 23:57:54 +0000 (00:57 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 May 2014 05:54:37 +0000 (07:54 +0200)
commitd751df64d58a9927b9c4b47aa7cf20204d0ab2f6
treef39ecdf0145e00c3ddcac394d95a3716fe76f337
parent0e37e30a8f55140dc1702b2d2008d41155bb3360
netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages

commit b22f5126a24b3b2f15448c3f2a254fc10cbc2b92 upstream

Some occurences in the netfilter tree use skb_header_pointer() in
the following way ...

  struct dccp_hdr _dh, *dh;
  ...
  skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);

... where dh itself is a pointer that is being passed as the copy
buffer. Instead, we need to use &_dh as the forth argument so that
we're copying the data into an actual buffer that sits on the stack.

Currently, we probably could overwrite memory on the stack (e.g.
with a possibly mal-formed DCCP packet), but unintentionally, as
we only want the buffer to be placed into _dh variable.

Fixes: 2bc780499aa3 ("[NETFILTER]: nf_conntrack: add DCCP protocol support")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/netfilter/nf_conntrack_proto_dccp.c