Skip to content

Commit

Permalink
module: ignore module path after null character
Browse files Browse the repository at this point in the history
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: nodejs#13787
  • Loading branch information
zimbabao committed Jun 19, 2017
1 parent 1e2905f commit 0419b14
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/parallel/test-require-exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ assert.throws(function() {
require(`${common.fixturesDir}/throws_error`);
}, /^Error: blah$/);

// Requiring the module with null character
assert.throws(function() {
require('../\u0000on');
}, /^Error: blah$/); //TODO: Fix the acual error

// Requiring a module that does not exist should throw an
// error with its `code` set to MODULE_NOT_FOUND
assertModuleNotFound('/DOES_NOT_EXIST');
Expand Down

0 comments on commit 0419b14

Please sign in to comment.