diff options
author | pneubeck <pneubeck@chromium.org> | 2015-03-23 08:59:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-23 16:00:42 +0000 |
commit | 3be384afc1fd8127a07918fb2d8ceaa923d76f85 (patch) | |
tree | 12c15f0643f418bdcf629344e7816cea0fb8ef5c /chromeos/network/onc | |
parent | 7b5c99151173320f7be6476205218e243075f9e7 (diff) | |
download | chromium_src-3be384afc1fd8127a07918fb2d8ceaa923d76f85.zip chromium_src-3be384afc1fd8127a07918fb2d8ceaa923d76f85.tar.gz chromium_src-3be384afc1fd8127a07918fb2d8ceaa923d76f85.tar.bz2 |
Fix a case of writing an empty HexSSID to Shill.
This surfaced when trying to connect to a fake network setup by fake_shill_manager_client.cc.
Review URL: https://codereview.chromium.org/1023273004
Cr-Commit-Position: refs/heads/master@{#321783}
Diffstat (limited to 'chromeos/network/onc')
-rw-r--r-- | chromeos/network/onc/onc_utils.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/chromeos/network/onc/onc_utils.cc b/chromeos/network/onc/onc_utils.cc index 6045ef1..898638c 100644 --- a/chromeos/network/onc/onc_utils.cc +++ b/chromeos/network/onc/onc_utils.cc @@ -264,14 +264,19 @@ void FillInHexSSIDFieldsInOncObject(const OncValueSignature& signature, } void FillInHexSSIDField(base::DictionaryValue* wifi_fields) { - if (!wifi_fields->HasKey(::onc::wifi::kHexSSID)) { - std::string ssid_string; - wifi_fields->GetStringWithoutPathExpansion(::onc::wifi::kSSID, - &ssid_string); - wifi_fields->SetStringWithoutPathExpansion( - ::onc::wifi::kHexSSID, - base::HexEncode(ssid_string.c_str(), ssid_string.size())); + std::string ssid_string; + if (wifi_fields->HasKey(::onc::wifi::kHexSSID) || + !wifi_fields->GetStringWithoutPathExpansion(::onc::wifi::kSSID, + &ssid_string)) { + return; + } + if (ssid_string.empty()) { + ONC_LOG_ERROR("Found empty SSID field."); + return; } + wifi_fields->SetStringWithoutPathExpansion( + ::onc::wifi::kHexSSID, + base::HexEncode(ssid_string.c_str(), ssid_string.size())); } namespace { |