Skip to content

Commit

Permalink
Limit str to 100 to avoid ReDoS of 0.3s
Browse files Browse the repository at this point in the history
  • Loading branch information
karenyavine committed Apr 12, 2017
1 parent b83b36d commit 305f2dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 305f2dd

Please sign in to comment.