diff --git a/aquatic_http/src/workers/socket.rs b/aquatic_http/src/workers/socket.rs index 31c764b..7dc7e6e 100644 --- a/aquatic_http/src/workers/socket.rs +++ b/aquatic_http/src/workers/socket.rs @@ -429,6 +429,12 @@ impl Connection { position += body_len; + if position + 2 > self.response_buffer.len() { + ::log::error!("Response buffer is too short for response"); + + return Err(anyhow::anyhow!("Response buffer is too short for response")); + } + (&mut self.response_buffer[position..position + 2]).copy_from_slice(b"\r\n"); position += 2;