aboutsummaryrefslogtreecommitdiffstats
path: root/net/http/parser.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-12-01 17:11:19 +0100
committerKim Alvefur <zash@zash.se>2023-12-01 17:11:19 +0100
commit6187c44ca905824d9a713f36e8e35531a5ea2363 (patch)
tree2950bf0186c9626c96923c1de8aa4403a94485f9 /net/http/parser.lua
parent1f67f1170cee16feeb2f484f47e473de6dce00e0 (diff)
parent674b91b82b0ea6e3462aa5b26a424925a08fade8 (diff)
downloadprosody-6187c44ca905824d9a713f36e8e35531a5ea2363.tar.gz
prosody-6187c44ca905824d9a713f36e8e35531a5ea2363.zip
Merge 0.12->trunk
Diffstat (limited to 'net/http/parser.lua')
-rw-r--r--net/http/parser.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/http/parser.lua b/net/http/parser.lua
index 196c3faa..b7e8b46c 100644
--- a/net/http/parser.lua
+++ b/net/http/parser.lua
@@ -59,7 +59,13 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb)
while buffer:length() > 0 do
if state == nil then -- read request
local index = buffer:sub(1, headlimit):find("\r\n\r\n", nil, true);
- if not index then return; end -- not enough data
+ if not index then
+ if buffer:length() > headlimit then
+ return error_cb("header-too-large");
+ end
+ -- not enough data
+ return;
+ end
-- FIXME was reason_phrase meant to be passed on somewhere?
local method, path, httpversion, status_code, reason_phrase; -- luacheck: ignore reason_phrase
local first_line;