Skip to main content

read_c_string

Function read_c_string 

Source
pub fn read_c_string(ptr: usize) -> Option<String>
Expand description

Read a null-terminated C string from a user-space pointer.

§Safety

Caller must ensure ptr is a valid user-space address (or 0 for None). Reads at most 4096 bytes to guard against unterminated strings. The kernel reads user memory directly — PAGE_FAULT will trigger if the address is unmapped.