Bug 169902 - nsStandardURL::Resolve passes wrong length in some cases to ParseURL. r=dougt@netscape, sr=darin@netscape, a=brendan@mozilla.org

This commit is contained in:
dbradley%netscape.com 2002-10-14 19:20:54 +00:00
Родитель b07ae5e9d8
Коммит 9ca4fed1f3
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -1501,7 +1501,9 @@ nsStandardURL::Resolve(const nsACString &in, nsACString &out)
// filter out unexpected chars "\r\n\t" if necessary
nsCAutoString buf;
relpath = FilterString(relpath, buf);
// Calculate the new relpath length if FilterString modified it
const PRInt32 relpathLen = buf.Length() != 0 ?
buf.Length() : flat.Length();
// XXX hack hack hack
char *p = nsnull;
char **result = &p;
@ -1529,7 +1531,8 @@ nsStandardURL::Resolve(const nsACString &in, nsACString &out)
// relative urls should never contain a host, so we always want to use
// the noauth url parser.
// use it to extract a possible scheme
rv = mParser->ParseURL(relpath, flat.Length(),
rv = mParser->ParseURL(relpath,
relpathLen,
&scheme.mPos, &scheme.mLen,
nsnull, nsnull,
nsnull, nsnull);

Просмотреть файл

@ -133,7 +133,9 @@ nsBaseURLParser::ParseURL(const char *spec, PRInt32 specLen,
}
// ignore trailing whitespace and control characters
for (p = spec + specLen - 1; (*p > 0) && (*p <= ' '); --p);
for (p = spec + specLen - 1; (*p <= ' ') && (p != spec); --p)
;
specLen = p - spec + 1;
if (colon && (colon < slash || !slash)) {