mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1189852 - link broken when a line break is part of the hash r=mcmanus
This commit is contained in:
parent
fda9eeaa3a
commit
8c5113ec82
@ -1165,13 +1165,10 @@ nsStandardURL::SetSpec(const nsACString &input)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
}
|
||||
|
||||
int32_t refPos = input.FindChar('#');
|
||||
if (refPos != kNotFound) {
|
||||
const nsCSubstring& sub = Substring(input, refPos, input.Length());
|
||||
nsresult rv = CheckRefCharacters(sub);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
// NUL characters aren't allowed
|
||||
// \r\n\t are stripped out instead of returning error(see below)
|
||||
if (input.FindChar('\0') != kNotFound) {
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
}
|
||||
|
||||
// Make a backup of the curent URL
|
||||
@ -2446,27 +2443,6 @@ nsStandardURL::SetQuery(const nsACString &input)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStandardURL::CheckRefCharacters(const nsACString &input)
|
||||
{
|
||||
nsACString::const_iterator start, end;
|
||||
input.BeginReading(start);
|
||||
input.EndReading(end);
|
||||
for (; start != end; ++start) {
|
||||
switch (*start) {
|
||||
case 0x00:
|
||||
case 0x09:
|
||||
case 0x0A:
|
||||
case 0x0D:
|
||||
// These characters are not allowed in the Ref part.
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::SetRef(const nsACString &input)
|
||||
{
|
||||
@ -2477,9 +2453,8 @@ nsStandardURL::SetRef(const nsACString &input)
|
||||
|
||||
LOG(("nsStandardURL::SetRef [ref=%s]\n", ref));
|
||||
|
||||
nsresult rv = CheckRefCharacters(input);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
if (input.FindChar('\0') != kNotFound) {
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
}
|
||||
|
||||
if (mPath.mLen < 0)
|
||||
|
@ -236,8 +236,6 @@ private:
|
||||
|
||||
void FindHostLimit(nsACString::const_iterator& aStart,
|
||||
nsACString::const_iterator& aEnd);
|
||||
// Checks that the Ref contains only allowed characters
|
||||
nsresult CheckRefCharacters(const nsACString &input);
|
||||
|
||||
// mSpec contains the normalized version of the URL spec (UTF-8 encoded).
|
||||
nsCString mSpec;
|
||||
|
Loading…
Reference in New Issue
Block a user