Skip to content

Commit f53962e

Browse files
zhuangyaTooTallNate
authored andcommitted
remove ReDoS regexp in %o formatter (#504)
1 parent 52e1f21 commit f53962e

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
@@ -85,7 +85,9 @@ function useColors() {
8585
exports.formatters.o = function(v) {
8686
this.inspectOpts.colors = this.useColors;
8787
return util.inspect(v, this.inspectOpts)
88-
.replace(/\s*\n\s*/g, ' ');
88+
.split('\n').map(function(str) {
89+
return str.trim()
90+
}).join(' ');
8991
};
9092

9193
/**

0 commit comments

Comments
 (0)