mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-06-06 02:36:49 +08:00
Add some sanity check to avoid buffer overflow
This commit is contained in:
parent
d8f84b94d9
commit
cc7c2cfc73
@ -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++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user