mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
do not trust received msg length to read forever
This commit is contained in:
parent
f7eb24815c
commit
ff48ee4c5b
@ -191,12 +191,13 @@ uint16_t BridgeClass::transfer(const uint8_t *buff1, uint16_t len1,
|
||||
|
||||
// Recv data
|
||||
for (uint16_t i = 0; i < l; i++) {
|
||||
// Cut received data if rxbuffer is too small
|
||||
if (i >= rxlen)
|
||||
break;
|
||||
int c = timedRead(5);
|
||||
if (c < 0)
|
||||
continue;
|
||||
// Cut received data if rxbuffer is too small
|
||||
if (i < rxlen)
|
||||
rxbuff[i] = c;
|
||||
rxbuff[i] = c;
|
||||
crcUpdate(c);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user