Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1568)

Unified Diff: chromeos/network/onc/onc_utils.cc

Issue 1023273004: Fix a case of writing an empty HexSSID to Shill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_utils.cc
diff --git a/chromeos/network/onc/onc_utils.cc b/chromeos/network/onc/onc_utils.cc
index 6045ef17f9a7faac4d7eb42b7fb3475004621860..898638c0355f566e7f6acbb8d0c9c245be6409c8 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 {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698