Skip to content

Commit

Permalink
Limit str to 100 to avoid ReDoS of 0.3s (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
karenyavine authored and leo committed May 16, 2017
1 parent b83b36d commit caae298
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 caae298

Please sign in to comment.