Skip to content

Commit e9da0b5

Browse files
oneukumdavem330
authored andcommitted
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]>
1 parent 2f131de commit e9da0b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/usb/sr9700.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
413413
/* ignore the CRC length */
414414
len = (skb->data[1] | (skb->data[2] << 8)) - 4;
415415

416-
if (len > ETH_FRAME_LEN)
416+
if (len > ETH_FRAME_LEN || len > skb->len)
417417
return 0;
418418

419419
/* the last packet of current skb */

0 commit comments

Comments
 (0)