bug 1485515 - range check the network.trr.mode pref on read r=valentin

MozReview-Commit-ID: 8OdeXYQEzQJ

Differential Revision: https://phabricator.services.mozilla.com/D4332

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daniel Stenberg 2018-08-27 13:13:12 +00:00
parent 95343883e7
commit ef67442423

View File

@ -132,9 +132,13 @@ TRRService::ReadPrefs(const char *name)
{
MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
if (!name || !strcmp(name, TRR_PREF("mode"))) {
// 0 - off, 1 - parallel, 2 - TRR first, 3 - TRR only, 4 - shadow
// 0 - off, 1 - parallel, 2 - TRR first, 3 - TRR only, 4 - shadow,
// 5 - explicit off
uint32_t tmp;
if (NS_SUCCEEDED(Preferences::GetUint(TRR_PREF("mode"), &tmp))) {
if (tmp > MODE_TRROFF) {
tmp = MODE_TRROFF;
}
mMode = tmp;
}
}