Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP8266: add an error check for data overflow from modem side #9366

Merged
merged 1 commit into from
Jan 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/wifi/esp8266-driver/ESP8266/ESP8266.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,10 @@ int32_t ESP8266::_recv_tcp_passive(int id, void *data, uint32_t amount, uint32_t

// update internal variable tcp_data_avbl to reflect the remaining data
if (_sock_i[id].tcp_data_rcvd > 0) {
if (_sock_i[id].tcp_data_rcvd > (int32_t)amount) {
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_EBADMSG), \
"ESP8266::_recv_tcp_passive() too much data from modem\n");
}
if (_sock_i[id].tcp_data_avbl > _sock_i[id].tcp_data_rcvd) {
_sock_i[id].tcp_data_avbl -= _sock_i[id].tcp_data_rcvd;
} else {
Expand Down