From: Florian Westphal Date: Mon, 15 Feb 2010 17:15:55 +0000 (+0100) Subject: netfilter: ebtables: abort if next_offset is too small X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1756de262e41112a8a8927808eb2f03d21fd4786;p=sagit-ice-cold%2Fkernel_xiaomi_msm8998.git netfilter: ebtables: abort if next_offset is too small next_offset must be > 0, otherwise this loops forever. The offset also contains the size of the ebt_entry structure itself, so anything smaller is invalid. Signed-off-by: Florian Westphal Signed-off-by: Patrick McHardy --- diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index bcdf02d866b8..4370e9680487 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -444,6 +444,8 @@ static int ebt_verify_pointers(const struct ebt_replace *repl, break; if (left < e->next_offset) break; + if (e->next_offset < sizeof(struct ebt_entry)) + return -EINVAL; offset += e->next_offset; } }