1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Subject: [PATCH] Fix control messages are inflated

RFC7692 states that control messages should not be compressed so there is no
need to inflate these messages.

There can be a bug if a control message is received while processing a
compressed message since lws relies on the RSV bit of the first message to
inflate the rx buffer or not.
Here we also check the opcode to only inflate a message if it is a data message.

Fixes: #1470
This commit is contained in:
Guillaume Burel 2019-01-11 15:43:46 +01:00 committed by Andy Green
parent 613993300d
commit 4319ffe588

View file

@ -179,7 +179,7 @@ lws_extension_callback_pm_deflate(struct lws_context *context,
case LWS_EXT_CB_PAYLOAD_RX:
lwsl_ext(" %s: LWS_EXT_CB_PAYLOAD_RX: in %d, existing in %d\n",
__func__, ebuf->len, priv->rx.avail_in);
if (!(wsi->ws->rsv_first_msg & 0x40))
if (!(wsi->ws->rsv_first_msg & 0x40) || (wsi->ws->opcode & 8))
return 0;
// lwsl_hexdump_debug(ebuf->token, ebuf->len);