From 8d5f73018776a0d15fc8c1db98f2d69067d3996d Mon Sep 17 00:00:00 2001 From: James Pearson Date: Sat, 7 Mar 2020 14:13:47 +0000 Subject: [PATCH] Limit the length of the ANSI codes inputs --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 31ce7ff..bf2f8a3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -49,7 +49,7 @@ return tag } - return str.replace(/\[(\d+;)?(\d+)*m/g, function(match, b1, b2) { + return str.replace(/\[(\d{1,3};)?(\d{1,3})?m/g, function(match, b1, b2) { var i, code, res = '' if (b2 == '' || b2 == null) b2 = '0' for (i = 1; i < arguments.length - 2; i++) {