Skip to content

Commit

Permalink
fix: actually adjust the length after reading a block
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed May 16, 2022
1 parent 7fe0175 commit 5cc08bd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sdk/src/ipld.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub fn get(cid: &Cid) -> SyscallResult<Vec<u8>> {
let mut block = Vec::with_capacity(size as usize);
let remaining = sys::ipld::read(id, 0, block.as_mut_ptr(), size)?;
debug_assert_eq!(remaining, 0, "expected to read the block exactly");
block.set_len(size as usize);
Ok(block)
}
}
Expand Down

0 comments on commit 5cc08bd

Please # to comment.