netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
To: netfilter-devel@vger.kernel.org
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Subject: [PATCH 1/8] netfilter: ipset: Fix static checker warning in ip_set_core.c
Date: Mon, 15 Sep 2014 23:02:47 +0200	[thread overview]
Message-ID: <1410814974-9918-2-git-send-email-kadlec@blackhole.kfki.hu> (raw)
In-Reply-To: <1410814974-9918-1-git-send-email-kadlec@blackhole.kfki.hu>

Dan Carpenter reported the following static checker warning:

        net/netfilter/ipset/ip_set_core.c:1414 call_ad()
        error: 'nlh->nlmsg_len' from user is not capped properly

The payload size is limited now by the max size of size_t.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
---
 net/netfilter/ipset/ip_set_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 5593e97..4ca4e5c 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1397,7 +1397,8 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set,
 		struct nlmsghdr *rep, *nlh = nlmsg_hdr(skb);
 		struct sk_buff *skb2;
 		struct nlmsgerr *errmsg;
-		size_t payload = sizeof(*errmsg) + nlmsg_len(nlh);
+		size_t payload = min(SIZE_MAX,
+				     sizeof(*errmsg) + nlmsg_len(nlh));
 		int min_len = nlmsg_total_size(sizeof(struct nfgenmsg));
 		struct nlattr *cda[IPSET_ATTR_CMD_MAX+1];
 		struct nlattr *cmdattr;
-- 
1.8.5.1


  reply	other threads:[~2014-09-15 21:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15 21:02 [PATCH 0/8] ipset patches for nf-next Jozsef Kadlecsik
2014-09-15 21:02 ` Jozsef Kadlecsik [this message]
2014-09-15 21:02 ` [PATCH 2/8] netfilter: ipset: Add skbinfo extension kernel support in the ipset core Jozsef Kadlecsik
2014-09-15 21:02 ` [PATCH 3/8] netfilter: ipset: Add skbinfo extension kernel support for the bitmap set types Jozsef Kadlecsik
2014-09-15 21:02 ` [PATCH 4/8] netfilter: ipset: Add skbinfo extension kernel support for the hash " Jozsef Kadlecsik
2014-09-15 21:02 ` [PATCH 5/8] netfilter: ipset: Add skbinfo extension kernel support for the list set type Jozsef Kadlecsik
2014-09-15 21:02 ` [PATCH 6/8] netfilter: ipset: Add skbinfo extension support to SET target Jozsef Kadlecsik
2014-09-15 21:02 ` [PATCH 7/8] netfilter: ipset: send nonzero skbinfo extensions only Jozsef Kadlecsik
2014-09-15 21:02 ` [PATCH 8/8] netfilter: ipset: hash:mac type added to ipset Jozsef Kadlecsik
2014-09-16 16:50 ` [PATCH 0/8] ipset patches for nf-next Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410814974-9918-2-git-send-email-kadlec@blackhole.kfki.hu \
    --to=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).