]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
netfilter: ebtables: abort if next_offset is too small
authorFlorian Westphal <fwestphal@astaro.com>
Mon, 15 Feb 2010 17:15:55 +0000 (18:15 +0100)
committerPatrick McHardy <kaber@trash.net>
Mon, 15 Feb 2010 17:15:55 +0000 (18:15 +0100)
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 <fwestphal@astaro.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
net/bridge/netfilter/ebtables.c

index bcdf02d866b8d879f658ea20a635ed0a51836b08..4370e96804872f4a6583e1010bb3a7a87c9489ac 100644 (file)
@@ -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;
                }
        }