Skip to content

Commit 99d1c1c

Browse files
committed
fix: disable regexp backtracking
1 parent 9521e2d commit 99d1c1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/util/escape.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ function escapeArgument(arg, doubleEscapeMetaChars) {
1818

1919
// Sequence of backslashes followed by a double quote:
2020
// double up all the backslashes and escape the double quote
21-
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
21+
arg = arg.replace(/(?=\\*?)"/g, '$1$1\\"');
2222

2323
// Sequence of backslashes followed by the end of the string
2424
// (which will become a double quote later):
2525
// double up all the backslashes
26-
arg = arg.replace(/(\\*)$/, '$1$1');
26+
arg = arg.replace(/(?=\\*?)$/, '$1$1');
2727

2828
// All other backslashes occur literally
2929

0 commit comments

Comments
 (0)