]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: Don't read garbage in nft_ipv4_parse_payload()
authorPhil Sutter <phil@nwl.cc>
Wed, 19 Sep 2018 13:17:06 +0000 (15:17 +0200)
committerFlorian Westphal <fw@strlen.de>
Mon, 24 Sep 2018 09:50:00 +0000 (11:50 +0200)
The problem here is that get_frag() does not set 'inv' in any case, so
when later checking its value, garbage may be read. Sanitize this case
by setting 'inv' to false before calling get_frag().

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/nft-ipv4.c

index 20ed9428425dda6d52151035476780bf895f0d8e..39e6184489554c4fdbf9117a22780e4fc42d5384 100644 (file)
@@ -234,6 +234,7 @@ static void nft_ipv4_parse_payload(struct nft_xt_ctx *ctx,
                break;
        case offsetof(struct iphdr, frag_off):
                cs->fw.ip.flags |= IPT_F_FRAG;
+               inv = false;
                get_frag(ctx, e, &inv);
                if (inv)
                        cs->fw.ip.invflags |= IPT_INV_FRAG;