Commit 3a270378 authored by Jon Mann's avatar Jon Mann Committed by Commit Bot

Wi-Fi Sync: Prevent crash when serializing proxy settings.

All fields are not required in manual proxy settings, and when any
optional fields were omitted it was crashing. This adds guards to only
serialized the provided fields.

Bug: 966270
Fixed: 1091405
Change-Id: I9e5aef0b6181c9e766f4779389437d2677a4fc90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2232824Reviewed-by: default avatarJames Vecore <vecore@google.com>
Commit-Queue: Jon Mann <jonmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#775759}
parent 8b0994f9
......@@ -146,21 +146,33 @@ ProxyConfigurationProtoFromMojo(
sync_pb::
WifiConfigurationSpecifics_ProxyConfiguration_ManualProxyConfiguration*
manual_settings = proto.mutable_manual_proxy_configuration();
manual_settings->set_http_proxy_url(
proxy_settings->manual->http_proxy->host->active_value);
manual_settings->set_http_proxy_port(
proxy_settings->manual->http_proxy->port->active_value);
manual_settings->set_secure_http_proxy_url(
proxy_settings->manual->secure_http_proxy->host->active_value);
manual_settings->set_secure_http_proxy_port(
proxy_settings->manual->secure_http_proxy->port->active_value);
manual_settings->set_socks_host_url(
proxy_settings->manual->socks->host->active_value);
manual_settings->set_socks_host_port(
proxy_settings->manual->socks->port->active_value);
for (const std::string& domain :
proxy_settings->exclude_domains->active_value) {
manual_settings->add_whitelisted_domains(domain);
if (proxy_settings->manual->http_proxy) {
manual_settings->set_http_proxy_url(
proxy_settings->manual->http_proxy->host->active_value);
manual_settings->set_http_proxy_port(
proxy_settings->manual->http_proxy->port->active_value);
}
if (proxy_settings->manual->secure_http_proxy) {
manual_settings->set_secure_http_proxy_url(
proxy_settings->manual->secure_http_proxy->host->active_value);
manual_settings->set_secure_http_proxy_port(
proxy_settings->manual->secure_http_proxy->port->active_value);
}
if (proxy_settings->manual->socks) {
manual_settings->set_socks_host_url(
proxy_settings->manual->socks->host->active_value);
manual_settings->set_socks_host_port(
proxy_settings->manual->socks->port->active_value);
}
if (proxy_settings->exclude_domains) {
for (const std::string& domain :
proxy_settings->exclude_domains->active_value) {
manual_settings->add_whitelisted_domains(domain);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment