From 52fc6d50d49b95e4598e2c9bb65e15e37035bf28 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 16 Oct 2013 16:42:40 +0200 Subject: nusb/ether: fix wrong size check causing odd sized packets to be discarded (thanks mischief!) ethernet packets with sizes that where not multiples of 4 where discarded because the check uses the smsc frame size instead of the payload size. when a usb read returns just one packet, theres no next frame header and the calculated frame size is bigger than the usb read which caused the whole packet to be discarded as invalid. thanks to mischief for testing and debugging! --- sys/src/cmd/nusb/ether/smsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/src') diff --git a/sys/src/cmd/nusb/ether/smsc.c b/sys/src/cmd/nusb/ether/smsc.c index d5e0427d6..cefdeb2ed 100644 --- a/sys/src/cmd/nusb/ether/smsc.c +++ b/sys/src/cmd/nusb/ether/smsc.c @@ -219,7 +219,7 @@ smscread(Dev *ep, uchar *p, int plen) hd = GET4(bin); n = hd >> 16; m = (n + 4 + 3) & ~3; - if(n < 6 || m > nbin){ + if(n < 6 || n > nbin-4){ nbin = 0; return 0; } -- cgit v1.2.3