Skip to content

Commit 720f586

Browse files
chris-morgansteveklabnik
authored andcommitted
Fix #24872, XSS in docs not found page.
1 parent 40fe325 commit 720f586

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/doc/not_found.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ function populate_rust_search() {
5757

5858
// #18540, use a single token
5959

60+
var a = document.createElement("a");
61+
a.href = "http://doc.rust-lang.org/core/?search=" + encodeURIComponent(lt);
62+
a.textContent = lt;
6063
var search = document.getElementById('core-search');
61-
search.innerHTML = "<a href=\"http://doc.rust-lang.org/core/?search=" + lt + "\">" + lt + "</a>";
64+
search.innerHTML = "";
65+
search.appendChild(a);
6266
}
6367
populate_site_search();
6468
populate_rust_search();

0 commit comments

Comments
 (0)