mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
check for default protocol rx buf limit
This fixes http://libwebsockets.org/trac/ticket/13 When using the default rx protocol buffer, the check is performed against 0 not the default length. That's the case both in client and server code... There's no problem if you actually give a max frame size in the protocol definition. Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
182cb9ae5f
commit
ff5dbf91b1
1 changed files with 17 additions and 2 deletions
|
@ -230,12 +230,27 @@ int libwebsocket_client_rx_sm(struct libwebsocket *wsi, unsigned char c)
|
||||||
(wsi->u.ws.frame_mask_index++) & 3];
|
(wsi->u.ws.frame_mask_index++) & 3];
|
||||||
|
|
||||||
if (--wsi->u.ws.rx_packet_length == 0) {
|
if (--wsi->u.ws.rx_packet_length == 0) {
|
||||||
|
/* spill because we have the whole frame */
|
||||||
wsi->lws_rx_parse_state = LWS_RXPS_NEW;
|
wsi->lws_rx_parse_state = LWS_RXPS_NEW;
|
||||||
goto spill;
|
goto spill;
|
||||||
}
|
}
|
||||||
if (wsi->u.ws.rx_user_buffer_head !=
|
|
||||||
wsi->protocol->rx_buffer_size)
|
/*
|
||||||
|
* if there's no protocol max frame size given, we are
|
||||||
|
* supposed to default to LWS_MAX_SOCKET_IO_BUF
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!wsi->protocol->rx_buffer_size &&
|
||||||
|
wsi->u.ws.rx_user_buffer_head !=
|
||||||
|
LWS_MAX_SOCKET_IO_BUF)
|
||||||
break;
|
break;
|
||||||
|
else
|
||||||
|
if (wsi->protocol->rx_buffer_size &&
|
||||||
|
wsi->u.ws.rx_user_buffer_head !=
|
||||||
|
wsi->protocol->rx_buffer_size)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* spill because we filled our rx buffer */
|
||||||
spill:
|
spill:
|
||||||
|
|
||||||
handled = 0;
|
handled = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue