forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: detect nul bytes in InternalModuleReadFile()
Throw an exception when the path contains nul bytes, don't abort. Fixes: nodejs#13787
- Loading branch information
1 parent
eac0147
commit 6067ee7
Showing
2 changed files
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
|
||
// Nul bytes should throw, not abort. | ||
assert.throws(() => require('\u0000ab'), /Cannot find module '\u0000ab'/); | ||
assert.throws(() => require('a\u0000b'), /Cannot find module 'a\u0000b'/); | ||
assert.throws(() => require('ab\u0000'), /Cannot find module 'ab\u0000'/); |