about summary refs log tree commit diff
path: root/tvix/nix-compat/src/wire/bytes/mod.rs
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2024-04-30T08·55+0000
committeredef <edef@edef.eu>2024-04-30T09·16+0000
commit88f49c83513670113bc429abb478412de4ffd1a8 (patch)
tree95a59787e996eba0a88a4ea501324d654ec45a23 /tvix/nix-compat/src/wire/bytes/mod.rs
parentfd5fc31e652992097dbda176d0e3a159ae546d98 (diff)
fix(tvix/nix-compat/wire/bytes): return UnexpectedEof for unexpected EOF r/8040
Change-Id: I8cb79f93742cc3a9088701bc8c2795de893eb6a8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11547
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/nix-compat/src/wire/bytes/mod.rs')
-rw-r--r--tvix/nix-compat/src/wire/bytes/mod.rs5
1 files changed, 1 insertions, 4 deletions
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);