mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Add extra check for path traversal sanity v2.
This commit is contained in:
parent
869e2c87e5
commit
093e83da1a
1 changed files with 4 additions and 1 deletions
|
|
@ -234,15 +234,18 @@ nsChromeRegistry::Canonify(nsIURL* aChromeURL)
|
|||
aChromeURL->SetPath(path);
|
||||
}
|
||||
else {
|
||||
// prevent directory traversals ("..")
|
||||
// path is already unescaped once, but uris can get unescaped twice
|
||||
const char* pos = path.BeginReading();
|
||||
const char* end = path.EndReading();
|
||||
if (*pos == '/' || *pos == ' ') {
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
while (pos < end) {
|
||||
switch (*pos) {
|
||||
case ':':
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
case '.':
|
||||
// prevent directory traversals ("..")
|
||||
if (pos[1] == '.')
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue