Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants