toolkit: no thread panic in http_fetch, no casts, exact egress-proxy form
Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
@@ -33,7 +33,9 @@ impl From<std::io::Error> for InputError {
|
||||
/// (`Read::take`); more than MAX_INPUT is TooLarge.
|
||||
pub fn read_input(stdin: &mut dyn std::io::Read) -> Result<String, InputError> {
|
||||
let mut buf = Vec::new();
|
||||
let n = stdin.take(MAX_INPUT as u64 + 1).read_to_end(&mut buf)?;
|
||||
let n = stdin
|
||||
.take(u64::try_from(MAX_INPUT).map_or(u64::MAX, |n| n.saturating_add(1)))
|
||||
.read_to_end(&mut buf)?;
|
||||
if n > MAX_INPUT {
|
||||
return Err(InputError::TooLarge);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user