Skip to content

Commit 7928560

Browse files
Marcus ChangVeijo Pesonen
authored andcommitted
Add receive length check
In passive receive mode a maximum of 2048 bytes can be received at a time using the CIPRECVDATA command. This commit ensures that the command cannot be called with an amount larger than this.
1 parent 2fbcaab commit 7928560

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ESP8266/ESP8266.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,11 @@ int32_t ESP8266::_recv_tcp_passive(int id, void *data, uint32_t amount, uint32_t
612612
_process_oob(timeout, true);
613613
}
614614

615+
// +CIPRECVDATA supports up to 2048 bytes at a time
616+
if (amount > 2048) {
617+
amount = 2048;
618+
}
619+
615620
// NOTE: documentation v3.0 says '+CIPRECVDATA:<data_len>,' but it's not how the FW responds...
616621
bool done = _parser.send("AT+CIPRECVDATA=%d,%lu", id, amount)
617622
&& _parser.recv("+CIPRECVDATA,%ld:", &len)

0 commit comments

Comments
 (0)