Skip to content

Commit 24da481

Browse files
committed
fix(websockets): Fix handling of very large frames
1 parent cff0825 commit 24da481

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/AsyncWebSocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ void AsyncWebSocketClient::_onData(void *pbuf, size_t plen) {
624624
"[%s][%" PRIu32 "] DATA _pinfo: index: %" PRIu64 ", final: %" PRIu8 ", opcode: %" PRIu8 ", masked: %" PRIu8 ", len: %" PRIu64, _server->url(),
625625
_clientId, _pinfo.index, _pinfo.final, _pinfo.opcode, _pinfo.masked, _pinfo.len
626626
);
627-
const size_t datalen = std::min((size_t)(_pinfo.len - _pinfo.index), plen);
627+
const size_t datalen = static_cast<size_t>(std::min<uint64_t>(_pinfo.len - _pinfo.index, plen));
628628
if (!_handleClientFrame(data, datalen, datalen == plen)) { // datalen == plen means that we are processing the last part of the current TCP packet
629629
return; // client is now destroyed, so we must return immediately to avoid accessing any member
630630
}

0 commit comments

Comments
 (0)