From 4e3ad1ab626377b2457c439a5e10c0272bac9476 Mon Sep 17 00:00:00 2001 From: fffe Date: Thu, 23 Apr 2026 16:18:40 -0700 Subject: [PATCH] fix off-by-one in SCgiTask::event_read --- src/rpc/scgi_task.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/scgi_task.cc b/src/rpc/scgi_task.cc index 57c34b5a..66a62f3b 100644 --- a/src/rpc/scgi_task.cc +++ b/src/rpc/scgi_task.cc @@ -80,7 +80,7 @@ SCgiTask::close() { void SCgiTask::event_read() { - int bytes = ::recv(m_fileDesc, m_buffer.data() + m_position, m_buffer.size() - m_position, 0); + int bytes = ::recv(m_fileDesc, m_buffer.data() + m_position, m_buffer.size() - m_position - (m_content_length == 0), 0); if (bytes <= 0) { if (bytes == 0 || !(errno == EAGAIN || errno == EINTR))