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!
This commit is contained in:
parent
965bb2d248
commit
52fc6d50d4
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue