mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
Bug 337744 - tighten up resource: protocol handling, r=darin
This commit is contained in:
parent
9f50745981
commit
899574c818
@ -311,6 +311,11 @@ NS_IMETHODIMP
|
||||
nsResProtocolHandler::ResolveURI(nsIURI *uri, nsACString &result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
|
||||
if (!url)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
nsCAutoString host;
|
||||
nsCAutoString path;
|
||||
|
||||
@ -320,6 +325,13 @@ nsResProtocolHandler::ResolveURI(nsIURI *uri, nsACString &result)
|
||||
rv = uri->GetPath(path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString filepath;
|
||||
url->GetFilePath(filepath);
|
||||
|
||||
// Don't misinterpret the filepath as an absolute URI.
|
||||
if (filepath.FindChar(':') != -1)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
rv = GetSubstitution(host, getter_AddRefs(baseURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
Loading…
x
Reference in New Issue
Block a user