Skip to content

Commit 0419b14

Browse files
committed
module: ignore module path after null character
Null char as the first char as the path component of first argument of require causes a node crash. Ignoring null and all chars after that in require path. Fixes: #13787
1 parent 1e2905f commit 0419b14

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/parallel/test-require-exceptions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ assert.throws(function() {
3333
require(`${common.fixturesDir}/throws_error`);
3434
}, /^Error: blah$/);
3535

36+
// Requiring the module with null character
37+
assert.throws(function() {
38+
require('../\u0000on');
39+
}, /^Error: blah$/); //TODO: Fix the acual error
40+
3641
// Requiring a module that does not exist should throw an
3742
// error with its `code` set to MODULE_NOT_FOUND
3843
assertModuleNotFound('/DOES_NOT_EXIST');

0 commit comments

Comments
 (0)