ncurses-rs icon indicating copy to clipboard operation
ncurses-rs copied to clipboard

tigetstr wrapper is unsafe & provides no way to check for failures

Open swolchok opened this issue 7 years ago • 2 comments

A simple attempt to use it segfaults:

fn main() {
    let capability = tigetstr("idontexist");
    if capability.is_empty() {
        println!("empty");
    } else {
        println!("nonempty");
    }
}

tigetstr returns (char *)-1 if the capability doesn't exist, and a null pointer if the capability isn't supported. Neither one seems to be supported by the ncurses-rs wrapper.

swolchok avatar Dec 22 '17 21:12 swolchok

Thanks for reporting this! Have you worked around it or patched it up? A PR would be most appreciated.

jeaye avatar Jan 06 '18 21:01 jeaye

My workaround was to switch to the term crate, sorry.

swolchok avatar Feb 12 '18 23:02 swolchok