Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions that use raw pointers should be unsafe #15

Open
kornelski opened this issue Feb 2, 2021 · 0 comments
Open

Functions that use raw pointers should be unsafe #15

kornelski opened this issue Feb 2, 2021 · 0 comments

Comments

@kornelski
Copy link

Functions like these are a loophole in Rust's safety:

pub fn add_cached_mapping(name: *mut i8) -> u64 {
add_cached_mapping(12345 as *mut i8);

can cause a segfault despite being "safe".

These functions should be either marked as unsafe, or take CStr, or a &'static str or &'static [u8] and checking them for \0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant