Skip to content

Commit 5e024c3

Browse files
committed
netfilter: nfnetlink_osf: Fix a missing skb_header_pointer() NULL check
Do not assume that the tcph->doff field is correct when parsing for TCP options, skb_header_pointer() might fail to fetch these bits. Fixes: 11eeef4 ("netfilter: passive OS fingerprint xtables match") Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 7072a35 commit 5e024c3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/netfilter/nfnetlink_osf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ static const struct tcphdr *nf_osf_hdr_ctx_init(struct nf_osf_hdr_ctx *ctx,
186186

187187
ctx->optp = skb_header_pointer(skb, ip_hdrlen(skb) +
188188
sizeof(struct tcphdr), ctx->optsize, opts);
189+
if (!ctx->optp)
190+
return NULL;
189191
}
190192

191193
return tcp;

0 commit comments

Comments
 (0)