Index: net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc |
diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc |
index 32baeb7a634dbd85a67efaaf7de4a74b912dcadc..da19216a95aa89a01a11c4359ef91481b8b6b79a 100644 |
--- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc |
+++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc |
@@ -265,9 +265,15 @@ std::string DhcpProxyScriptAdapterFetcher::GetPacURLFromDhcp( |
LOG(INFO) << "Error fetching PAC URL from DHCP: " << res; |
UMA_HISTOGRAM_COUNTS("Net.DhcpWpadUnhandledDhcpError", 1); |
} else if (wpad_params.nBytesData) { |
- // The result should be ASCII, not wide character. |
- DCHECK_EQ(strlen(reinterpret_cast<const char*>(wpad_params.Data)) + 1, |
- wpad_params.nBytesData); |
+#ifndef NDEBUG |
+ // The result should be ASCII, not wide character. Some DHCP |
+ // servers appear to count the trailing NULL in nBytesData, others |
+ // do not. |
+ size_t count_without_null = |
+ strlen(reinterpret_cast<const char*>(wpad_params.Data)); |
+ DCHECK(count_without_null == wpad_params.nBytesData || |
+ count_without_null + 1 == wpad_params.nBytesData); |
+#endif |
// Return only up to the first null in case of embedded NULLs; if the |
// server is giving us back a buffer with embedded NULLs, something is |
// broken anyway. |