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

mvwgetstr, getstr, mvwinnstr, and wgetstr can produce strings that are invalid UTF-8 #187

Closed
thomcc opened this issue Jun 9, 2019 · 2 comments

Comments

@thomcc
Copy link

thomcc commented Jun 9, 2019

This is a memory safety problem, since many functions in the rust stdlib are UB if you have a non-utf8 string.

These functions should be changed to ensure that only valid utf8 is input.

See rustsec/advisory-db#106, although it's unclear if there's a way for this to be exploitable (unlike the others).

@jeaye
Copy link
Owner

jeaye commented Jun 15, 2019

Again, same point as before. ncurses-rs does not do any processing on top of just handing data to/from ncurses.

However, I appreciate your intention and I don't want to leave people using ncurses-rs thinking (and apparently knowing nothing about ncurses) that this could possibly be a safe library, so I've added the following: a52dbb3

I would be open to a PR marking all of the appropriate fns unsafe, but not any more PRs or issues around making ncurses-rs do anything more than its purpose. There are safer TUI libraries for Rust; hell, there are far safer TUI libraries for C, even.

@dpc
Copy link
Contributor

dpc commented Jun 21, 2019

This is note is most certainly not sufficient. Noone is going to read and find it.

All the functions should be marked as unsafe. That's what the language mandates.

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

No branches or pull requests

3 participants