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

src: detect nul bytes in InternalModuleReadFile() #14854

Closed
wants to merge 1 commit into from

Conversation

bnoordhuis
Copy link
Member

@bnoordhuis bnoordhuis commented Aug 16, 2017

Throw an exception when the path contains nul bytes, don't abort.

Fixes: #13787
CI: https://ci.nodejs.org/job/node-test-pull-request/9683/

Throw an exception when the path contains nul bytes, don't abort.

Fixes: nodejs#13787
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. labels Aug 16, 2017
@bnoordhuis
Copy link
Member Author

I didn't add a check to InternalModuleStat() because:

  1. Performance. It's called much more often.
  2. It seems unnecessary. Worst case you stat the wrong file but InternalModuleReadFile() will still catch it.

@addaleax
Copy link
Member

Landed in ffed7b6

@addaleax addaleax closed this Aug 21, 2017
addaleax pushed a commit that referenced this pull request Aug 21, 2017
Throw an exception when the path contains nul bytes, don't abort.

Fixes: #13787
PR-URL: #14854
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this pull request Sep 10, 2017
Throw an exception when the path contains nul bytes, don't abort.

Fixes: #13787
PR-URL: #14854
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Sep 10, 2017
MylesBorins pushed a commit that referenced this pull request Sep 12, 2017
Throw an exception when the path contains nul bytes, don't abort.

Fixes: #13787
PR-URL: #14854
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@MylesBorins
Copy link
Contributor

I've backported this to v6.x. please let me know if it should be backed out

MylesBorins pushed a commit that referenced this pull request Sep 20, 2017
Throw an exception when the path contains nul bytes, don't abort.

Fixes: #13787
PR-URL: #14854
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants