gatewayd: strict status lines and chunk lines; no as casts (M4a review, findings 1 and 3)

A status line splits on single spaces only, and every chunk line must end in CRLF. The bounded
`as` casts in http.rs, handshake.rs and proto's sha1.rs become try_from and from.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-24 01:23:51 -07:00
co-authored by Claude Opus 5.5
parent 131b3677fd
commit 0081f24b70
5 changed files with 87 additions and 28 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ impl Sha1 {
// Use `split_at` and `get_mut(..)`, no indexing that can go out of bounds.
self.length = self
.length
.wrapping_add(8u64.wrapping_mul(data.len() as u64));
.wrapping_add(8u64.wrapping_mul(u64::try_from(data.len()).unwrap_or(u64::MAX)));
while !data.is_empty() {
let space = 64 - self.filled;
let take = data.len().min(space);