зеркало из https://github.com/mozilla/gecko-dev.git
Bug 739040 - Use the length of the decoded string, if no more than 512 bytes, to sniff for feeds; r=Mano a=blocking
This commit is contained in:
Родитель
610bfe1c83
Коммит
7cddf62356
|
@ -69,7 +69,7 @@
|
|||
#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
#define NS_RSS "http://purl.org/rss/1.0/"
|
||||
|
||||
#define MAX_BYTES 512
|
||||
#define MAX_BYTES 512u
|
||||
|
||||
NS_IMPL_ISUPPORTS3(nsFeedSniffer,
|
||||
nsIContentSniffer,
|
||||
|
@ -324,8 +324,9 @@ nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request,
|
|||
// We cap the number of bytes to scan at MAX_BYTES to prevent picking up
|
||||
// false positives by accidentally reading document content, e.g. a "how to
|
||||
// make a feed" page.
|
||||
if (length > MAX_BYTES)
|
||||
length = MAX_BYTES;
|
||||
if (!mDecodedData.IsEmpty()) {
|
||||
length = NS_MIN(mDecodedData.Length(), MAX_BYTES);
|
||||
}
|
||||
|
||||
// Thus begins the actual sniffing.
|
||||
nsDependentCSubstring dataString((const char*)testData, length);
|
||||
|
|
Загрузка…
Ссылка в новой задаче