зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1696138 - Make a copy of the host before calling getaddrinfo r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D118010
This commit is contained in:
Родитель
3791d0d415
Коммит
66462a439a
|
@ -9315,6 +9315,13 @@
|
|||
value: true
|
||||
mirror: always
|
||||
|
||||
# When this pref is true, we copy the host name to a fresh string before
|
||||
# calling into getaddrinfo.
|
||||
- name: network.dns.copy_string_before_call
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# The proxy type. See nsIProtocolProxyService.idl
|
||||
# PROXYCONFIG_DIRECT = 0
|
||||
# PROXYCONFIG_MANUAL = 1
|
||||
|
|
|
@ -350,7 +350,14 @@ nsresult GetAddrInfo(const nsACString& aHost, uint16_t aAddressFamily,
|
|||
return (*aAddrInfo)->Addresses().Length() ? NS_OK : NS_ERROR_UNKNOWN_HOST;
|
||||
}
|
||||
|
||||
nsAutoCString host(aHost);
|
||||
nsAutoCString host;
|
||||
if (StaticPrefs::network_dns_copy_string_before_call()) {
|
||||
host = Substring(aHost.BeginReading(), aHost.Length());
|
||||
MOZ_ASSERT(aHost.BeginReading() != host.BeginReading());
|
||||
} else {
|
||||
host = aHost;
|
||||
}
|
||||
|
||||
if (gNativeIsLocalhost) {
|
||||
// pretend we use the given host but use IPv4 localhost instead!
|
||||
host = "localhost"_ns;
|
||||
|
|
Загрузка…
Ссылка в новой задаче