diff options
author | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-21 08:32:01 +0000 |
---|---|---|
committer | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-21 08:32:01 +0000 |
commit | 7ba4e66628a078800a1bb0222e568e35894e870d (patch) | |
tree | 0dd7d961d421797177537b8408c90e00ae2cc32a /chrome | |
parent | 255a54a1f9a59fd8d6a48c1cbae6ebd0192dd037 (diff) | |
download | chromium_src-7ba4e66628a078800a1bb0222e568e35894e870d.zip chromium_src-7ba4e66628a078800a1bb0222e568e35894e870d.tar.gz chromium_src-7ba4e66628a078800a1bb0222e568e35894e870d.tar.bz2 |
chromeos: Fix SIMLock state parse error
BUG=chromium-os:16557
TEST=boot a device with --disable-libcros option and a SIM card inserted, see there is no "Error parsing SIMLock state" in /var/log/ui/ui.LATEST
Review URL: http://codereview.chromium.org/10168006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133342 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/chromeos/cros/native_network_parser.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/chrome/browser/chromeos/cros/native_network_parser.cc b/chrome/browser/chromeos/cros/native_network_parser.cc index 1aaaacf..f4a4d3a 100644 --- a/chrome/browser/chromeos/cros/native_network_parser.cc +++ b/chrome/browser/chromeos/cros/native_network_parser.cc @@ -549,13 +549,25 @@ bool NativeNetworkDeviceParser::ParseSimLockStateFromDictionary( int* out_retries, bool* out_enabled) { std::string state_string; + // Since RetriesLeft is sent as a uint32, which may overflow int32 range, from + // Flimflam, it may be stored as an integer or a double in DictionaryValue. + base::Value* retries_value = NULL; if (!info.GetString(flimflam::kSIMLockTypeProperty, &state_string) || - !info.GetInteger(flimflam::kSIMLockRetriesLeftProperty, out_retries) || - !info.GetBoolean(flimflam::kSIMLockEnabledProperty, out_enabled)) { + !info.GetBoolean(flimflam::kSIMLockEnabledProperty, out_enabled) || + !info.Get(flimflam::kSIMLockRetriesLeftProperty, &retries_value) || + (retries_value->GetType() != base::Value::TYPE_INTEGER && + retries_value->GetType() != base::Value::TYPE_DOUBLE)) { LOG(ERROR) << "Error parsing SIMLock state"; return false; } *out_state = ParseSimLockState(state_string); + if (retries_value->GetType() == base::Value::TYPE_INTEGER) { + retries_value->GetAsInteger(out_retries); + } else if (retries_value->GetType() == base::Value::TYPE_DOUBLE) { + double retries_double = 0; + retries_value->GetAsDouble(&retries_double); + *out_retries = retries_double; + } return true; } |