diff --git a/README.md b/README.md index c297948..3a0b2ac 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# aquatic +# aquatic: high-performance BitTorrent tracker [![CargoBuildAndTest](https://github.com/greatest-ape/aquatic/actions/workflows/cargo-build-and-test.yml/badge.svg)](https://github.com/greatest-ape/aquatic/actions/workflows/cargo-build-and-test.yml) [![Test HTTP, UDP and WSS file transfer](https://github.com/greatest-ape/aquatic/actions/workflows/test-transfer.yml/badge.svg)](https://github.com/greatest-ape/aquatic/actions/workflows/test-transfer.yml) 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;