Skip to content

os/unix/lib.rs implementation passes non-zero-terminated strings to dlopen/dlsym #10

@rzheka

Description

@rzheka

E.g.:

let path_to_lib_str =
            path_to_lib
                .as_ref()
                .to_string_lossy();
        let path_to_lib_c_str = path_to_lib_str.as_ptr() as *const c_char;

here path_to_lib_c_str is not really a c_str, but a pointer to a regular Rust utf8 string slice. The issue can be reproduced with something like this:

let name = "mylib.so123";
LibUnsafe::new(&name[0..8]).unwrap();

where mylib.so is a valid shared lib that can be located by dlopen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions