mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 09:13:55 +08:00
ipv6: sr: fix out-of-bounds access in SRH validation
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 <andreyknvl@google.com> Cc: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: David Lebrun <david.lebrun@uclouvain.be> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c1f8d0f98c
commit
2f3bb64247
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user