mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 17:02:17 +00:00
sr9700: sanity check for packet length
A malicious device can leak heap data to user space providing bogus frame lengths. Introduce a sanity check. Signed-off-by: Oliver Neukum <[email protected]> Reviewed-by: Grant Grundler <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
committed by
David S. Miller
parent
2f131de361
commit
e9da0b56fe
@@ -413,7 +413,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
|
||||
/* ignore the CRC length */
|
||||
len = (skb->data[1] | (skb->data[2] << 8)) - 4;
|
||||
|
||||
if (len > ETH_FRAME_LEN)
|
||||
if (len > ETH_FRAME_LEN || len > skb->len)
|
||||
return 0;
|
||||
|
||||
/* the last packet of current skb */
|
||||
|
||||
Reference in New Issue
Block a user