From abf3e7015e1f77b2d665c1e0e4e4477100d8623b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Mon, 31 Jan 2022 19:59:42 +0100 Subject: [PATCH 1/3] http: don't send response if body is too long for buffer --- aquatic_http/src/workers/socket.rs | 6 ++++++ 1 file changed, 6 insertions(+) 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; From 88deed89a7ea53ad10aab513e962661926e38c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Mon, 31 Jan 2022 20:05:35 +0100 Subject: [PATCH 2/3] README: use more descriptive title --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c297948..5ecb160 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# aquatic +# aquatic: high-performance BitTorrent tracker (UDP, HTTP, WebTorrent) [![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) From 9209a3ee01b619f71ce13272e005fb87acccb35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Mon, 31 Jan 2022 20:08:17 +0100 Subject: [PATCH 3/3] README: improve title --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ecb160..3a0b2ac 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# aquatic: high-performance BitTorrent tracker (UDP, HTTP, WebTorrent) +# 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)