To clarify further, the idiomatic usage of `unsafe` in Rust stipulates that if you can&#x27;t guarantee that your function is memory-safe for all possible inputs, then you must mark the function itself as `unsafe` to force callers to be aware of the risk. Obviously if you&#x27;re both calling this theoretical function from a language without an `unsafe` construct and if you&#x27;re also striving to maintain exact API compatibility with the C function then you can&#x27;t really make this aware to the caller. If you do have control of the API then the way that this would generally be presented on the Rust side would be to have two functions: a safe one named &quot;foo&quot; that also takes the length as an argument so that you can check at runtime and an unsafe function named &quot;unsafe_foo&quot; that has the same behavior as the C function.