mirror of
https://github.com/luc-github/ESP3D.git
synced 2025-10-31 11:56:48 -07:00
Add some sanity check to avoid buffer overflow
This commit is contained in:
@@ -268,6 +268,10 @@ size_t WebSocket_Server::writeBytes(const uint8_t *buffer, size_t size) {
|
|||||||
}
|
}
|
||||||
// need periodic check to force to flush in case of no end
|
// need periodic check to force to flush in case of no end
|
||||||
for (uint i = 0; i < size; i++) {
|
for (uint i = 0; i < size; i++) {
|
||||||
|
//add a sanity check to avoid buffer overflow
|
||||||
|
if (_TXbufferSize >= TXBUFFERSIZE) {
|
||||||
|
flushTXbuffer();
|
||||||
|
}
|
||||||
_TXbuffer[_TXbufferSize] = buffer[i];
|
_TXbuffer[_TXbufferSize] = buffer[i];
|
||||||
_TXbufferSize++;
|
_TXbufferSize++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user