Skip to content

Macro rl_str! may cause UB due to temporary CString pointer #21

@ewpratten

Description

@ewpratten

The rl_str! macro currently uses format!("{}\0", $expression).as_ptr() as *const i8, which produces a pointer to a temporary string. This can result in undefined behavior if the pointer outlives the macro expansion, as the temporary may be dropped before it is used by the FFI call.

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