]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
netfilter: nfnetlink: validate nfnetlink header from batch
authorPablo Neira Ayuso <pablo@netfilter.org>
Sun, 4 Jan 2015 14:20:29 +0000 (15:20 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 2 Feb 2015 10:01:01 +0000 (10:01 +0000)
commit 9ea2aa8b7dba9e99544c4187cc298face254569f upstream.

Make sure there is enough room for the nfnetlink header in the
netlink messages that are part of the batch. There is a similar
check in netlink_rcv_skb().

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
net/netfilter/nfnetlink.c

index c138b8fbe280af6886693421a7fe8d9a288156cf..6ae88ace21cbca106216284d93ac93c29379d984 100644 (file)
@@ -273,7 +273,8 @@ replay:
                nlh = nlmsg_hdr(skb);
                err = 0;
 
-               if (nlh->nlmsg_len < NLMSG_HDRLEN) {
+               if (nlmsg_len(nlh) < sizeof(struct nfgenmsg) ||
+                   skb->len < nlh->nlmsg_len) {
                        err = -EINVAL;
                        goto ack;
                }