From 781520fef8e9c21c819f6eca7fab4e7645621c34 Mon Sep 17 00:00:00 2001 From: xirvik Date: Mon, 10 Aug 2026 02:13:54 +0000 Subject: [PATCH] Close the connection when an SCGI header does not fit the buffer. A malformed header aborted the process from the SCGI thread. --- src/rpc/scgi_task.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rpc/scgi_task.cc b/src/rpc/scgi_task.cc index f9a05882..647851b7 100644 --- a/src/rpc/scgi_task.cc +++ b/src/rpc/scgi_task.cc @@ -94,8 +94,12 @@ SCgiTask::event_read() { if (m_content_length == 0) read_length--; - if (read_length <= 0) + if (read_length <= 0) { + if (m_content_length == 0) + return close(); + throw torrent::internal_error("SCgiTask::event_read() no space in buffer for event_read."); + } int bytes = ::recv(file_descriptor(), m_buffer.data() + m_position, read_length, 0);