From 88f49c83513670113bc429abb478412de4ffd1a8 Mon Sep 17 00:00:00 2001 From: edef Date: Tue, 30 Apr 2024 08:55:39 +0000 Subject: fix(tvix/nix-compat/wire/bytes): return UnexpectedEof for unexpected EOF Change-Id: I8cb79f93742cc3a9088701bc8c2795de893eb6a8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11547 Reviewed-by: flokli Tested-by: BuildkiteCI --- tvix/nix-compat/src/wire/bytes/mod.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'tvix') diff --git a/tvix/nix-compat/src/wire/bytes/mod.rs b/tvix/nix-compat/src/wire/bytes/mod.rs index 0c637e6c3921..436667731815 100644 --- a/tvix/nix-compat/src/wire/bytes/mod.rs +++ b/tvix/nix-compat/src/wire/bytes/mod.rs @@ -61,10 +61,7 @@ where // make sure we got exactly the number of bytes, and not less. if s as u64 != padded_len { - return Err(std::io::Error::new( - std::io::ErrorKind::InvalidData, - "got less bytes than expected", - )); + return Err(std::io::ErrorKind::UnexpectedEof.into()); } let (_content, padding) = buf.split_at(len as usize); -- cgit 1.4.1