Skip to content

Commit

Permalink
clone
Browse files Browse the repository at this point in the history
  • Loading branch information
2501babe committed Apr 5, 2024
1 parent 66c596e commit 5845503
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion programs/bpf_loader/src/syscalls/sysvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ fn get_sysvar<T: std::fmt::Debug + Sysvar + SysvarId + Clone>(
)?;
let var = translate_type_mut::<T>(memory_mapping, var_addr, check_aligned)?;

*var = sysvar?;
// this clone looks unecessary, but it exists to zero out trailing alignment bytes
// it is unclear whether this should ever matter
// but there are tests using MemoryMapping that expect to see this
// we preserve the previous behavior out of an abundance of caution
*var = sysvar?.clone();

Ok(SUCCESS)
}
Expand Down

0 comments on commit 5845503

Please sign in to comment.