From 992f40c7a1f79a3d70830a0c5fd7b76bfb2fd544 Mon Sep 17 00:00:00 2001 From: Liu DongMiao Date: Tue, 5 Mar 2024 17:43:36 +0800 Subject: [PATCH] raw-skt: don't read more than rx_buffer_size When other roles like ws reading data, they follow `rx_buffer_size`, then fallback to context's `pt_serv_buf_size`. However, `raw-skt` don't follow `rx_buffer_size`, always use 0, then fallback to `pt_serv_buf_size`. This PR make `raw-skt` don't read more than `rx_buffer_size` data. --- lib/roles/raw-skt/ops-raw-skt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/roles/raw-skt/ops-raw-skt.c b/lib/roles/raw-skt/ops-raw-skt.c index 5f0a89886..c2a70f0ce 100644 --- a/lib/roles/raw-skt/ops-raw-skt.c +++ b/lib/roles/raw-skt/ops-raw-skt.c @@ -174,7 +174,7 @@ rops_handle_POLLIN_raw_skt(struct lws_context_per_thread *pt, struct lws *wsi, #endif default: ebuf.token = NULL; - ebuf.len = 0; + ebuf.len = (int) wsi->a.protocol->rx_buffer_size; buffered = lws_buflist_aware_read(pt, wsi, &ebuf, 1, __func__); switch (ebuf.len) {