From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 2/8] netfilter: ipset: small potential read beyond the end of buffer
Date: Fri, 14 Nov 2014 17:58:43 +0100 [thread overview]
Message-ID: <1415984329-5569-4-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1415984329-5569-1-git-send-email-pablo@netfilter.org>
From: Dan Carpenter <dan.carpenter@oracle.com>
We could be reading 8 bytes into a 4 byte buffer here. It seems
harmless but adding a check is the right thing to do and it silences a
static checker warning.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/ipset/ip_set_core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 86f9d76..d259da3 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1863,6 +1863,12 @@ ip_set_sockfn_get(struct sock *sk, int optval, void __user *user, int *len)
if (*op < IP_SET_OP_VERSION) {
/* Check the version at the beginning of operations */
struct ip_set_req_version *req_version = data;
+
+ if (*len < sizeof(struct ip_set_req_version)) {
+ ret = -EINVAL;
+ goto done;
+ }
+
if (req_version->version != IPSET_PROTOCOL) {
ret = -EPROTO;
goto done;
--
1.7.10.4
next prev parent reply other threads:[~2014-11-14 16:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 16:58 [PATCH 0/8] Netfilter/IPVS fixes for net Pablo Neira Ayuso
2014-11-14 16:58 ` Pablo Neira Ayuso
2014-11-14 16:58 ` [PATCH 1/8] netfilter: nft_masq: fix uninitialized range in nft_masq_{ipv4, ipv6}_eval Pablo Neira Ayuso
2014-11-14 16:58 ` Pablo Neira Ayuso [this message]
2014-11-14 16:58 ` [PATCH 3/8] ipvs: Keep skb->sk when allocating headroom on tunnel xmit Pablo Neira Ayuso
2014-11-14 16:58 ` [PATCH 4/8] netfilter: nft_compat: use current net namespace Pablo Neira Ayuso
2014-11-14 16:58 ` [PATCH 5/8] netfilter: nft_compat: relax chain type validation Pablo Neira Ayuso
2014-11-14 16:58 ` [PATCH 6/8] netfilter: nft_compat: use the match->table to validate dependencies Pablo Neira Ayuso
2014-11-14 16:58 ` [PATCH 7/8] netfilter: nf_tables: restore synchronous object release from commit/abort Pablo Neira Ayuso
2014-11-14 16:58 ` [PATCH 8/8] netfilter: conntrack: fix race in __nf_conntrack_confirm against get_next_corpse Pablo Neira Ayuso
2014-11-16 19:24 ` [PATCH 0/8] Netfilter/IPVS fixes for net David Miller
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=1415984329-5569-4-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.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).