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

panic of unwrap() on CString creation #77

Open
alexanderkjall opened this issue Aug 19, 2020 · 0 comments
Open

panic of unwrap() on CString creation #77

alexanderkjall opened this issue Aug 19, 2020 · 0 comments

Comments

@alexanderkjall
Copy link

Hi

I did some fuzzing of display of untrusted strings in cursive that uses this library and found this crash:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: NulError(0, [0])', /home/capitol/.cargo/registry/src/github.com-1ecc6299db9ec823/pancurses-0.16.1/src/window.rs:392:47

It seems to be because the library uses this construct CString::new(string.as_ref()).unwrap(); which fails on some strings, for example a string created like this:

let null : Vec<u8> = vec![0];
let null_str = str::from_utf8(&null).unwrap();

As far as I can find there is 8 different cases of this pattern.

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

1 participant