diff options
author | David Lebrun <david.lebrun@uclouvain.be> | 2017-04-18 17:59:49 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-20 15:40:33 -0400 |
commit | 2f3bb64247b5b083d05ccecad9c2e139bbfdc294 (patch) | |
tree | c430df72c12b236b7ff4c18145ff8cc1850e0129 /net/ipv6/seg6.c | |
parent | c1f8d0f98c3bc12393821c1bf00d8eaa0bd58bd8 (diff) | |
download | op-kernel-dev-2f3bb64247b5b083d05ccecad9c2e139bbfdc294.zip op-kernel-dev-2f3bb64247b5b083d05ccecad9c2e139bbfdc294.tar.gz |
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>
Diffstat (limited to 'net/ipv6/seg6.c')
-rw-r--r-- | net/ipv6/seg6.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c index a855eb3..5f44ffe 100644 --- a/net/ipv6/seg6.c +++ b/net/ipv6/seg6.c @@ -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; |