mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 02:05:30 +00:00
Merge pull request #46 from greatest-ape/work-2022-01-31
http: don't panic if response body is too long for buffer; update README
This commit is contained in:
commit
e629d49448
2 changed files with 7 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# aquatic
|
||||
# aquatic: high-performance BitTorrent tracker
|
||||
|
||||
[](https://github.com/greatest-ape/aquatic/actions/workflows/cargo-build-and-test.yml) [](https://github.com/greatest-ape/aquatic/actions/workflows/test-transfer.yml)
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue