Skip to content

Commit

Permalink
ipv6: Fix out-of-bounds access in ipv6_find_tlv()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Gavrilov Ilia authored and davem330 committed May 24, 2023
1 parent ba46c96 commit 878ecb0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/ipv6/exthdrs_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ int ipv6_find_tlv(const struct sk_buff *skb, int offset, int type)
optlen = 1;
break;
default:
if (len < 2)
goto bad;
optlen = nh[offset + 1] + 2;
if (optlen > len)
goto bad;
Expand Down

0 comments on commit 878ecb0

Please sign in to comment.