Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Commit

Permalink
Fix infinite recursion with maliciously crafted URL
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Jul 19, 2021
1 parent 1d93674 commit 30c12da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/js/main-blocked.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ uDom('.what').text(details.url);
return s;
};

let renderParams = function(parentNode, rawURL) {
let renderParams = function(parentNode, rawURL, depth = 0) {
let a = document.createElement('a');
a.href = rawURL;
if ( a.search.length === 0 ) { return false; }
Expand All @@ -108,9 +108,9 @@ uDom('.what').text(details.url);
let name = safeDecodeURIComponent(param.slice(0, pos));
let value = safeDecodeURIComponent(param.slice(pos + 1));
li = liFromParam(name, value);
if ( reURL.test(value) ) {
if ( depth < 2 && reURL.test(value) ) {
let ul = document.createElement('ul');
renderParams(ul, value);
renderParams(ul, value, depth + 1);
li.appendChild(ul);
}
parentNode.appendChild(li);
Expand Down

0 comments on commit 30c12da

Please sign in to comment.