mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
bug 1451928 - loop detection added for the TRR CNAME parser r=valentin
MozReview-Commit-ID: 8vLjS7hOYKU --HG-- extra : rebase_source : 69b82c3df7db7d19f0667e9de0c6c67b7c7794fe
This commit is contained in:
parent
80e0b61efb
commit
11c34a5b83
@ -622,6 +622,7 @@ TRR::DohDecode()
|
||||
if (mCname.IsEmpty()) {
|
||||
uint8_t clength = 0;
|
||||
unsigned int cindex = index;
|
||||
unsigned int loop = 128; // a valid DNS name can never loop this much
|
||||
do {
|
||||
if (cindex >= mBodySize) {
|
||||
LOG(("TRR: bad cname packet\n"));
|
||||
@ -654,7 +655,12 @@ TRR::DohDecode()
|
||||
mCname.Append((const char *)(&mResponse[cindex]), clength);
|
||||
cindex += clength; // skip label
|
||||
}
|
||||
} while (clength);
|
||||
} while (clength && --loop);
|
||||
|
||||
if (!loop) {
|
||||
LOG(("TRR::DohDecode pointer loop error\n"));
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
LOG(("TRR::DohDecode CNAME host %s => %s\n",
|
||||
host.get(), mCname.get()));
|
||||
|
Loading…
Reference in New Issue
Block a user