nsh
nsh copied to clipboard
Crash on binary strings
The following snippets crash nsh:
- Invalid UTF-8 in the command substitution output:
$(printf '\xff')
. - Invalid UTF-8 in env vars: (run from bash)
A=$'\xff' ./target/release/nsh
. - Null byte in command arguments:
true $(printf '\x00')
.
Possible fix to 1 and 2: store strings in Vec<u8>
, OsString
, or bstr
rather than String
which forces strings to be valid UTF-8.
Proper behavior for 3 is not specified for POSIX sh; other shells treat it differently.
Good catch and thanks for detailed explanation! I'll work on it when I have time :)