netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch -mainline] netfilter: ipset: small potential read beyond the end of buffer
@ 2014-11-07  6:21 Dan Carpenter
  2014-11-10 14:24 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2014-11-07  6:21 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller,
	Sergey Popovich, Masanari Iida, Anton Danilov, stephen hemminger,
	netfilter-devel, coreteam, netdev, kernel-janitors

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>

diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 86f9d76..ac08a3f 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1863,7 +1863,8 @@ 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 (req_version->version != IPSET_PROTOCOL) {
+		if (*len < sizeof(struct ip_set_req_version) ||
+		    req_version->version != IPSET_PROTOCOL) {
 			ret = -EPROTO;
 			goto done;
 		}

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-11-11 13:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-07  6:21 [patch -mainline] netfilter: ipset: small potential read beyond the end of buffer Dan Carpenter
2014-11-10 14:24 ` Pablo Neira Ayuso
2014-11-10 14:27   ` Jozsef Kadlecsik
2014-11-10 16:11     ` Pablo Neira Ayuso
2014-11-10 21:00       ` Jozsef Kadlecsik
2014-11-11 13:17         ` Pablo Neira Ayuso
2014-11-10 22:38       ` Dan Carpenter

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).