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

Crash on binary strings #14

Open
xzfc opened this issue Oct 23, 2021 · 1 comment
Open

Crash on binary strings #14

xzfc opened this issue Oct 23, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@xzfc
Copy link

xzfc commented Oct 23, 2021

The following snippets crash nsh:

  1. Invalid UTF-8 in the command substitution output: $(printf '\xff').
  2. Invalid UTF-8 in env vars: (run from bash) A=$'\xff' ./target/release/nsh.
  3. 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.

@nuta nuta added the bug Something isn't working label Oct 24, 2021
@nuta
Copy link
Owner

nuta commented Oct 24, 2021

Good catch and thanks for detailed explanation! I'll work on it when I have time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants