* [PATCH] netfilter: fix out-of-bounds access in nat addr selection
@ 2012-09-05 20:10 Florian Westphal
2012-09-10 9:14 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2012-09-05 20:10 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
include/linux/jhash.h:138:16: warning: array subscript is above array bounds
[jhash2() expects the number of u32 in the key]
Signed-off-by: Florian Westphal <fw@strlen.de>
---
Only affects -next.
note that I also get same warning for hash_by_src(); but
hash = jhash2((u32 *)&tuple->src, sizeof(tuple->src) / sizeof(u32),
tuple->dst.protonum ^ zone ^ nf_conntrack_hash_rnd);
looks correct to me.
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index 29d4452..1816ad3 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -255,7 +255,7 @@ find_best_ips_proto(u16 zone, struct nf_conntrack_tuple *tuple,
* client coming from the same IP (some Internet Banking sites
* like this), even across reboots.
*/
- j = jhash2((u32 *)&tuple->src.u3, sizeof(tuple->src.u3),
+ j = jhash2((u32 *)&tuple->src.u3, sizeof(tuple->src.u3) / sizeof(u32),
range->flags & NF_NAT_RANGE_PERSISTENT ?
0 : (__force u32)tuple->dst.u3.all[max] ^ zone);
--
1.7.8.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] netfilter: fix out-of-bounds access in nat addr selection
2012-09-05 20:10 [PATCH] netfilter: fix out-of-bounds access in nat addr selection Florian Westphal
@ 2012-09-10 9:14 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2012-09-10 9:14 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
On Wed, Sep 05, 2012 at 10:10:28PM +0200, Florian Westphal wrote:
> include/linux/jhash.h:138:16: warning: array subscript is above array bounds
> [jhash2() expects the number of u32 in the key]
Applied to -next, thanks Florian.
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> Only affects -next.
> note that I also get same warning for hash_by_src(); but
> hash = jhash2((u32 *)&tuple->src, sizeof(tuple->src) / sizeof(u32),
> tuple->dst.protonum ^ zone ^ nf_conntrack_hash_rnd);
> looks correct to me.
It also seems correct to me, that tuple->src is 5*4 bytes long.
I'm not hitting any warning with gcc-4.7 though.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-10 9:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-05 20:10 [PATCH] netfilter: fix out-of-bounds access in nat addr selection Florian Westphal
2012-09-10 9:14 ` Pablo Neira Ayuso
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).