mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-07 01:54:26 +01:00
Merge pull request #2781 from arve0/yun_bridge_bug_read_forever
Bridge: discard message if length is bigger than buffer size
This commit is contained in:
commit
375013173d
@ -191,12 +191,13 @@ uint16_t BridgeClass::transfer(const uint8_t *buff1, uint16_t len1,
|
|||||||
|
|
||||||
// Recv data
|
// Recv data
|
||||||
for (uint16_t i = 0; i < l; i++) {
|
for (uint16_t i = 0; i < l; i++) {
|
||||||
|
// Cut received data if rxbuffer is too small
|
||||||
|
if (i >= rxlen)
|
||||||
|
break;
|
||||||
int c = timedRead(5);
|
int c = timedRead(5);
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
continue;
|
continue;
|
||||||
// Cut received data if rxbuffer is too small
|
rxbuff[i] = c;
|
||||||
if (i < rxlen)
|
|
||||||
rxbuff[i] = c;
|
|
||||||
crcUpdate(c);
|
crcUpdate(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user