Skip to content

Commit 878ecb0

Browse files
Gavrilov Iliadavem330
authored andcommitted
ipv6: Fix out-of-bounds access in ipv6_find_tlv()
optlen is fetched without checking whether there is more than one byte to parse. It can lead to out-of-bounds access. Found by InfoTeCS on behalf of Linux Verification Center (linuxtesting.org) with SVACE. Fixes: c61a404 ("[IPV6]: Find option offset by type.") Signed-off-by: Gavrilov Ilia <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ba46c96 commit 878ecb0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv6/exthdrs_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ int ipv6_find_tlv(const struct sk_buff *skb, int offset, int type)
143143
optlen = 1;
144144
break;
145145
default:
146+
if (len < 2)
147+
goto bad;
146148
optlen = nh[offset + 1] + 2;
147149
if (optlen > len)
148150
goto bad;

0 commit comments

Comments
 (0)