diff options
author | Alexander Kutsan <AKutsan@luxoft.com> | 2015-05-05 11:35:57 +0300 |
---|---|---|
committer | Alexander Kutsan <AKutsan@luxoft.com> | 2015-05-07 11:25:56 +0300 |
commit | 90fb55317ffc12c7d3cebf189727cc42cc424be0 (patch) | |
tree | ab44fa416e0cf0c8a73290550c0bdbc81051efa5 /src/3rd_party-static | |
parent | 375ed7e0549adedfc72564a5fd0b4ffe9c39cea6 (diff) | |
download | sdl_core-90fb55317ffc12c7d3cebf189727cc42cc424be0.tar.gz |
Parce WebSockedData fix
Diffstat (limited to 'src/3rd_party-static')
-rw-r--r-- | src/3rd_party-static/MessageBroker/src/lib_messagebroker/websocket_handler.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/3rd_party-static/MessageBroker/src/lib_messagebroker/websocket_handler.cpp b/src/3rd_party-static/MessageBroker/src/lib_messagebroker/websocket_handler.cpp index b9c97f7ff9..d99087dd98 100644 --- a/src/3rd_party-static/MessageBroker/src/lib_messagebroker/websocket_handler.cpp +++ b/src/3rd_party-static/MessageBroker/src/lib_messagebroker/websocket_handler.cpp @@ -80,7 +80,8 @@ namespace NsMessageBroker unsigned char position = 0; // current buffer position unsigned int size = b_size; - while (0 < size) { + static uint32_t minimum_heade_size = 4; + while (minimum_heade_size < size) { bool fin = ((recBuffer[0] & 0x80) | (recBuffer[0] & 0x01)) == 0x81; bool rsv1 = (recBuffer[0] & 0x40) == 0x40; @@ -125,8 +126,8 @@ namespace NsMessageBroker position = 2; if (length > size) { - DBG_MSG_ERROR(("Incomplete message")); - return b_size; + DBG_MSG_ERROR(("Incomplete message")); + break; } switch(payload) { @@ -164,16 +165,14 @@ namespace NsMessageBroker DBG_MSG(("CWebSocketHandler::parseWebSocketData()length:%d; size:%d;" " position:%d\n", (int)length, size, position)); - for (unsigned long i = position; (i < size && i < position+length); i++) - { - Buffer[parsedBufferPosition++] = recBuffer[i]; + for (unsigned long i = 0; (i < size); i++) { + Buffer[parsedBufferPosition + i] = recBuffer[i+position]; } - - recBuffer += length+position; + b_size -= position; + parsedBufferPosition += length; + recBuffer += length; size -= length+position; } - - b_size = parsedBufferPosition; return b_size; } |