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

Kernel.exec should raise an ArgumentError if the command includes a null byte #704

Merged
merged 1 commit into from May 4, 2013

Conversation

Projects
None yet
2 participants
@atambo
Copy link
Member

commented May 4, 2013

No description provided.

@headius

This comment has been minimized.

Copy link
Member

commented May 4, 2013

I think the spirit of this spec is that if a null byte appears anywhere in the String, we should raise the error.

A couple other notes:

  • Don't remove the convertToString. The error that results from passing a non-String would go away.
  • After the convertToString, you have a RubyString in hand. You can get the ByteList out of it and walk the bytes directly, which will be more efficient than converting to a Java string.
@atambo

This comment has been minimized.

Copy link
Member Author

commented May 4, 2013

Done. Let me know if the amended commit above doesn't cover everything.

@headius

This comment has been minimized.

Copy link
Member

commented May 4, 2013

you can actually iterate the raw bytes directly, using "getUnsafeBytes", but this is fine for now. I doubt anyone will have a command line long enough to be a performance problem :-)

Merging shortly.

headius added a commit that referenced this pull request May 4, 2013

Merge pull request #704 from atambo/kernel_exec_error_on_null_byte
Kernel.exec should raise an ArgumentError if the command includes a null byte

@headius headius merged commit d90f2db into jruby:master May 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.