diff options
author | edef <edef@edef.eu> | 2024-04-30T09·35+0000 |
---|---|---|
committer | edef <edef@edef.eu> | 2024-04-30T09·55+0000 |
commit | 06f94a21bd355e13fa4a51817f5d3f128add9928 (patch) | |
tree | 712df8020a658a91a51a9e7493fc51715abe699e /tvix/nix-compat/src/nix_daemon/worker_protocol.rs | |
parent | 095f715a8045933159cb7daf3302246b9ca50658 (diff) |
fix(tvix/nix-compat/wire): RangeInclusive<usize> for memory size bounds r/8043
u64 is an inappropriate type for something memory-sized, and most callers end up with off-by-ones when using `..` rather than `..=`, including the tests for the module itself. Change-Id: If3b7bea27eb0a6c01e0a5d7e64966acbbb664268 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11550 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/nix-compat/src/nix_daemon/worker_protocol.rs')
-rw-r--r-- | tvix/nix-compat/src/nix_daemon/worker_protocol.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/nix-compat/src/nix_daemon/worker_protocol.rs b/tvix/nix-compat/src/nix_daemon/worker_protocol.rs index 9ffceffced1b..5f877c8cee7b 100644 --- a/tvix/nix-compat/src/nix_daemon/worker_protocol.rs +++ b/tvix/nix-compat/src/nix_daemon/worker_protocol.rs @@ -21,7 +21,7 @@ static PROTOCOL_VERSION: ProtocolVersion = ProtocolVersion::from_parts(1, 37); /// /// This value has been arbitrarily choosen after looking the nix.conf /// manpage. Don't hesitate to increase it if it's too limiting. -pub static MAX_SETTING_SIZE: u64 = 1024; +pub static MAX_SETTING_SIZE: usize = 1024; /// Worker Operation /// @@ -153,8 +153,8 @@ pub async fn read_client_settings<R: AsyncReadExt + Unpin>( if client_version.minor() >= 12 { let num_overrides = r.read_u64_le().await?; for _ in 0..num_overrides { - let name = wire::read_string(r, 0..MAX_SETTING_SIZE).await?; - let value = wire::read_string(r, 0..MAX_SETTING_SIZE).await?; + let name = wire::read_string(r, 0..=MAX_SETTING_SIZE).await?; + let value = wire::read_string(r, 0..=MAX_SETTING_SIZE).await?; overrides.insert(name, value); } } |