From 4e8ec7840f89d0c1cc48e39535211be9755e8c1b Mon Sep 17 00:00:00 2001 From: pommicket Date: Fri, 29 Aug 2025 04:32:41 -0400 Subject: Fix max response length to account for "embedded IPv4" addresses --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc31115..e03c2c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,7 +32,7 @@ dependencies = [ [[package]] name = "ipaddrsrv" -version = "0.1.0" +version = "0.1.1" dependencies = [ "ctrlc", ] diff --git a/Cargo.toml b/Cargo.toml index d6aef46..f05f2b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ipaddrsrv" -version = "0.1.0" +version = "0.1.1" edition = "2024" [dependencies] diff --git a/src/main.rs b/src/main.rs index ffa1892..3c03b46 100644 --- a/src/main.rs +++ b/src/main.rs @@ -78,13 +78,13 @@ impl ConnectionSettings { } } if conn.state == 4 { - // 90B is more than long enough for our response + // 128B is more than long enough for our response write!( - &mut buffer[..90], + &mut buffer[..128], "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n{addr}\n\0" ) .expect("?? writing address to buffer failed??"); - let length = buffer[..90] + let length = buffer[..128] .iter() .position(|&c| c == 0) .expect("?? no null byte even though we just wrote one??"); -- cgit v1.2.3