Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

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

Open
swolchok opened this issue Dec 22, 2017 · 2 comments
Open

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

swolchok opened this issue Dec 22, 2017 · 2 comments

Comments

@swolchok
Copy link

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.

@jeaye
Copy link
Owner

jeaye commented Jan 6, 2018

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

@swolchok
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants