From caae2988ba2a37765d055c4eee63d383320ee662 Mon Sep 17 00:00:00 2001 From: Karen Yavine Date: Tue, 16 May 2017 12:08:29 +0300 Subject: [PATCH] Limit str to 100 to avoid ReDoS of 0.3s (#89) --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 8d79c47..6a522b1 100644 --- a/index.js +++ b/index.js @@ -46,7 +46,7 @@ module.exports = function(val, options) { function parse(str) { str = String(str); - if (str.length > 10000) { + if (str.length > 100) { return; } var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(