Michael-F-Bryan / rust-ffi-guide

A guide for doing FFI using Rust
https://michael-f-bryan.github.io/rust-ffi-guide/
Creative Commons Zero v1.0 Universal
282 stars 18 forks source link

CString.as_ptr() Problem #50

Open Michael-F-Bryan opened 6 years ago

Michael-F-Bryan commented 6 years ago

Problem 3 (link) is about dangling pointers. In particular it uses the CString.as_ptr() method to get a pointer to some temporary CString.

The solution section should talk about what dangling pointers are and how we ended up in this situation. You may want to use CString.as_ptr() is incredibly unsafe as a reference.