Skip to content

Commit

Permalink
netfilter: nfnetlink_osf: Fix a missing skb_header_pointer() NULL check
Browse files Browse the repository at this point in the history
[ Upstream commit 5e024c325406470d1165a09c6feaf8ec897936be ]

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]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
ummakynes authored and gregkh committed May 22, 2021
1 parent bb101fb commit e11924b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/netfilter/nfnetlink_osf.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ static const struct tcphdr *nf_osf_hdr_ctx_init(struct nf_osf_hdr_ctx *ctx,

ctx->optp = skb_header_pointer(skb, ip_hdrlen(skb) +
sizeof(struct tcphdr), ctx->optsize, opts);
if (!ctx->optp)
return NULL;
}

return tcp;
Expand Down

0 comments on commit e11924b

Please sign in to comment.