mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-06 00:13:33 +00:00
Fixed bug in WebSocketStream partial fragment handler, where if fragment buffer size was 0, it would not realloc() correctly.
Also updated self-test to have inline documentation, as well as support for console debugging
This commit is contained in:
@@ -4373,6 +4373,7 @@ ILibTransport_DoneState ILibDuktape_httpStream_webSocket_EncodedWriteSink(ILibDu
|
||||
if (state->WebSocketFragmentIndex + plen >= state->WebSocketFragmentBufferSize)
|
||||
{
|
||||
// Need to grow the buffer
|
||||
if (state->WebSocketFragmentBufferSize == 0) { state->WebSocketFragmentBufferSize = 4096; }
|
||||
state->WebSocketFragmentBufferSize = state->WebSocketFragmentBufferSize * 2;
|
||||
if ((state->WebSocketFragmentBuffer = (char*)realloc(state->WebSocketFragmentBuffer, state->WebSocketFragmentBufferSize)) == NULL) { ILIBCRITICALEXIT(254); } // MS Static Analyser erroneously reports that this leaks the original memory block
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user