Skip to content

Commit c38a016

Browse files
zhuangyaTooTallNate
authored andcommitted
remove ReDoS regexp in %o formatter (#504)
1 parent 47747f3 commit c38a016

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/node.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ function useColors() {
8383
exports.formatters.o = function(v) {
8484
this.inspectOpts.colors = this.useColors;
8585
return util.inspect(v, this.inspectOpts)
86-
.replace(/\s*\n\s*/g, ' ');
86+
.split('\n').map(function(str) {
87+
return str.trim()
88+
}).join(' ');
8789
};
8890

8991
/**

0 commit comments

Comments
 (0)