Skip to content

Commit eda8170

Browse files
committed
Fix udprpc hiffy backend deserialization
1 parent ebaeedd commit eda8170

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

humility-hiffy/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,13 @@ impl<'a> HiffyContext<'a> {
697697
if code != 0 {
698698
return Err(Failure::FunctionError(code));
699699
}
700-
rval[0..nreply as usize]
701-
.copy_from_slice(&buf[5..(5 + nreply as usize)]);
700+
// The reply may be shorter than `nreply` bytes, if this is an Idol
701+
// call that uses serialization for its return type. `buf` has
702+
// already been trimmed based on actual reply length.
703+
let reply = &buf[5..];
704+
rval[0..][..reply.len()].copy_from_slice(reply);
702705

706+
// Return the original `nreply`, to match the Hubris implementation
703707
Ok(nreply.try_into().unwrap())
704708
}
705709
////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)