Function cobhan::bytes_to_cbuffer

source ·
pub unsafe fn bytes_to_cbuffer(bytes: &[u8], buffer: *mut c_char) -> i32
Expand description

Takes a Vec<u8> and fallibly encodes it into a provided external Cobhan Buffer.

Will cause an error code if the provided Cobhan Buffer is too small.

Notes

This function does a memcopy from the Rust data into the provided Cobhan Buffer.

Safety

Behavior is undefined if any of the following conditions are violated:

  • The Cobhan Buffer Header size is not correctly reserved or formatted.
  • Any of the Safety conditions of std::slice::from_raw_parts is violated.