Skip to content

Conversation

@RReverser
Copy link
Collaborator

It seems to be the only such occurence, but I might have missed more.

Fixes #19230.

It seems to be the only such occurence, but I might have missed more.

Fixes #19230.
@RReverser RReverser requested a review from sbc100 April 21, 2023 20:32
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting... I'm not sure what tool turns that into a literal 0, but sgtm to escape it. We could also just write "0" there I guess, which would be human-readable enough.

* @param {number=} maxBytesToRead - An optional length that specifies the
* maximum number of bytes to read. You can omit this parameter to scan the
* string until the first \0 byte. If maxBytesToRead is passed, and the string
* string until the first \\0 byte. If maxBytesToRead is passed, and the string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about null or NULL instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that works for me too, just wasn't sure if you'd be open to that. Or, as @kripken says, just "0 byte" also sounds good, I'll probably go with that.

@RReverser
Copy link
Collaborator Author

I'm not sure what tool turns that into a literal 0

It's literally part of a JS string now and JS strings support escapes, so a string `'something \0 something`` gets nul character unescaped, just like it would be in string literals in most other langs.

@RReverser RReverser enabled auto-merge (squash) April 21, 2023 21:52
@RReverser RReverser merged commit f011b5c into main Apr 21, 2023
@RReverser RReverser deleted the fix-nul-char branch April 21, 2023 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3.1.35+ contains NUL characters in JS

4 participants