aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-09-17 16:41:48 +0100
committerMatthew Wild <mwild1@gmail.com>2020-09-17 16:41:48 +0100
commit344958724eb1e171c421183e28ca01184492b3f6 (patch)
treefb2f25303f33c81f8a53e73a61c7901ba5ec9c40 /plugins
parenta96430a8430583ace88bd608f726f5bf448f2223 (diff)
downloadprosody-344958724eb1e171c421183e28ca01184492b3f6.tar.gz
prosody-344958724eb1e171c421183e28ca01184492b3f6.zip
mod_websocket: handle full frame buffer and raise stream error
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_websocket.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/mod_websocket.lua b/plugins/mod_websocket.lua
index ad94486b..d3b035db 100644
--- a/plugins/mod_websocket.lua
+++ b/plugins/mod_websocket.lua
@@ -275,7 +275,11 @@ function handle_request(event)
-- max frame header is 22 bytes
local frameBuffer = dbuffer.new(stanza_size_limit + 22, frame_fragment_limit);
add_filter(session, "bytes/in", function(data)
- frameBuffer:write(data);
+ if not frameBuffer:write(data) then
+ session.log("warn", "websocket frame buffer full - terminating session");
+ session:close({ condition = "resource-constraint", text = "frame buffer exceeded" });
+ return;
+ end
local cache = {};
local frame, length = parse_frame(frameBuffer);