Skip to content

Commit

Permalink
remove ReDoS regexp in %o formatter (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuangya authored and TooTallNate committed Sep 22, 2017
1 parent 52e1f21 commit f53962e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ function useColors() {
exports.formatters.o = function(v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts)
.replace(/\s*\n\s*/g, ' ');
.split('\n').map(function(str) {
return str.trim()
}).join(' ');
};

/**
Expand Down

0 comments on commit f53962e

Please sign in to comment.