Skip to content

Commit

Permalink
ipv6: sr: fix out-of-bounds access in SRH validation
Browse files Browse the repository at this point in the history
This patch fixes an out-of-bounds access in seg6_validate_srh() when the
trailing data is less than sizeof(struct sr6_tlv).

Reported-by: Andrey Konovalov <[email protected]>
Cc: Andrey Konovalov <[email protected]>
Signed-off-by: David Lebrun <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
David Lebrun authored and davem330 committed Apr 20, 2017
1 parent c1f8d0f commit 2f3bb64
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ipv6/seg6.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len)
struct sr6_tlv *tlv;
unsigned int tlv_len;

if (trailing < sizeof(*tlv))
return false;

tlv = (struct sr6_tlv *)((unsigned char *)srh + tlv_offset);
tlv_len = sizeof(*tlv) + tlv->len;

Expand Down

0 comments on commit 2f3bb64

Please sign in to comment.