Function cobhan::cbuffer_to_string

source ·
pub unsafe fn cbuffer_to_string(buffer: *const c_char) -> Result<String, i32>
Expand description

Takes a pointer to an external Cobhan Buffer and fallibly attempts to interpret it as a String.

The String is fallibly checked to ensure UTF-8 formatting.

Notes

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

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.