mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #18823 from Diff-fusion/master
drivers/ethos: Fix off-by-one bug
This commit is contained in:
commit
780309d71a
@ -373,16 +373,17 @@ static int _recv(netdev_t *netdev, void *buf, size_t len, void* info)
|
||||
DEBUG("ethos _recv(): inbuf doesn't contain enough bytes.\n");
|
||||
return -EIO;
|
||||
}
|
||||
tmp = ethos_unstuff_readbyte(ptr, (uint8_t)byte, &escaped, &frametype);
|
||||
ptr += tmp;
|
||||
res += tmp;
|
||||
if ((unsigned)res > len) {
|
||||
while (byte != (int)ETHOS_FRAME_DELIMITER) {
|
||||
if ((unsigned)res >= len) {
|
||||
while (byte != (int)ETHOS_FRAME_DELIMITER && byte >= 0) {
|
||||
/* clear out unreceived packet */
|
||||
byte = tsrb_get_one(&dev->inbuf);
|
||||
}
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
tmp = ethos_unstuff_readbyte(ptr, (uint8_t)byte, &escaped, &frametype);
|
||||
ptr += tmp;
|
||||
res += tmp;
|
||||
} while (byte != ETHOS_FRAME_DELIMITER);
|
||||
|
||||
switch (frametype) {
|
||||
|
Loading…
Reference in New Issue
Block a user