Fixed a bug causing a buffer overflow in the WiFi101 library
This commit is contained in:
parent
ab9a195124
commit
26b175844e
2 changed files with 3 additions and 3 deletions
|
@ -563,7 +563,7 @@ unsigned SSLClient::m_update_engine() {
|
|||
unsigned char * buf = br_ssl_engine_recvrec_buf(&m_sslctx.eng, &len);
|
||||
// do we have the record you're looking for?
|
||||
const auto avail = get_arduino_client().available();
|
||||
if (avail > 0 && static_cast<size_t>(avail) >= len) {
|
||||
if (avail > 0) {
|
||||
int mem = freeMemory();
|
||||
#if defined(ARDUINO_ARCH_SAMD)
|
||||
// check for a stack overflow
|
||||
|
@ -590,7 +590,7 @@ unsigned SSLClient::m_update_engine() {
|
|||
return 0;
|
||||
}
|
||||
// I suppose so!
|
||||
int rlen = get_arduino_client().read(buf, len);
|
||||
int rlen = get_arduino_client().read(buf, avail < len ? avail : len);
|
||||
if (rlen <= 0) {
|
||||
m_error("Error reading bytes from m_client. Write Error: ", func_name);
|
||||
m_error(get_arduino_client().getWriteError(), func_name);
|
||||
|
|
|
@ -407,7 +407,7 @@ private:
|
|||
//============================================
|
||||
//= Data Members
|
||||
//============================================
|
||||
// create a copy of the client
|
||||
// create a reference the client
|
||||
Client& m_client;
|
||||
// also store an array of SSLSessions, so we can resume communication with multiple websites
|
||||
std::vector<SSLSession> m_sessions;
|
||||
|
|
Loading…
Reference in a new issue