Skip to content

panic of unwrap() on CString creation #77

@alexanderkjall

Description

@alexanderkjall

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.

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