solana_sdk::program_memory

Function sol_memset

source
pub fn sol_memset(s: &mut [u8], c: u8, n: usize)
Expand description

Like C memset.

§Arguments

  • s - Slice to be set
  • c - Repeated byte to set
  • n - Number of bytes to set

§Errors

When executed within a SBF program, the memory region spanning n bytes from from the start of s must be mapped program memory. If not, the program will abort.

§Safety

This function is incorrectly missing an unsafe declaration.

This function does not verify that n is less than or equal to the length of the s slice passed to it — it will write bytes beyond the slice.

Specifying an n greater than the length of s will likely introduce undefined behavior.