From 7dbf21efc2339dea557f1ca1b6701299fe797b8c Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 28 Dec 2015 13:40:54 +0800 Subject: [PATCH] autobahn extend max ping pong close payload to 125 We only supported those specific control packet payloads up to 124. 125 is the correct limit. Lws was consistent about the wrong limit so there are no other issues. It doesn't affect user ABI correcting it either. Signed-off-by: Andy Green --- lib/client-parser.c | 2 +- lib/parsers.c | 2 +- lib/private-libwebsockets.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/client-parser.c b/lib/client-parser.c index 12096a435..845e6f448 100644 --- a/lib/client-parser.c +++ b/lib/client-parser.c @@ -309,7 +309,7 @@ spill: } /* control packets can only be < 128 bytes long */ - if (wsi->u.ws.rx_user_buffer_head > 128 - 4) { + if (wsi->u.ws.rx_user_buffer_head > 128 - 3) { lwsl_parser("DROP PING payload too large\n"); goto ping_drop; } diff --git a/lib/parsers.c b/lib/parsers.c index adcdc2947..ed36ecde3 100644 --- a/lib/parsers.c +++ b/lib/parsers.c @@ -1025,7 +1025,7 @@ spill: } process_as_ping: /* control packets can only be < 128 bytes long */ - if (wsi->u.ws.rx_user_buffer_head > 128 - 4) { + if (wsi->u.ws.rx_user_buffer_head > 128 - 3) { lwsl_parser("DROP PING payload too large\n"); goto ping_drop; } diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index 8647919da..07fb2a1f3 100644 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -839,7 +839,7 @@ struct _lws_websocket_related { unsigned int rx_user_buffer_head; unsigned char mask_nonce[4]; /* Also used for close content... control opcode == < 128 */ - unsigned char ping_payload_buf[128 - 4 + LWS_SEND_BUFFER_PRE_PADDING]; + unsigned char ping_payload_buf[128 - 3 + LWS_SEND_BUFFER_PRE_PADDING]; unsigned char ping_payload_len; unsigned char frame_mask_index;