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

Unified Diff: chrome/browser/chromeos/login/owner_key_utils.cc

Issue 10399104: Fixes an issue when the owner key is empty chrome would crash trying to access bogus memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed the empty case to return false instead. Created 8 years, 7 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 | chrome/browser/chromeos/login/owner_key_utils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/owner_key_utils.cc
diff --git a/chrome/browser/chromeos/login/owner_key_utils.cc b/chrome/browser/chromeos/login/owner_key_utils.cc
index c4654bfbd0108ccdbbb72d380c73c4fd1917c839..39058ecc32662610fc5aae486978231f2753ac53 100644
--- a/chrome/browser/chromeos/login/owner_key_utils.cc
+++ b/chrome/browser/chromeos/login/owner_key_utils.cc
@@ -123,6 +123,12 @@ bool OwnerKeyUtilsImpl::ImportPublicKey(const FilePath& key_file,
int32 safe_file_size = static_cast<int32>(file_size);
output->resize(safe_file_size);
+
+ if (safe_file_size == 0) {
+ LOG(WARNING) << "Public key file is empty. This seems wrong.";
Mattias Nissler (ping if slow) 2012/05/21 16:30:34 nit: Remove "This seems wrong.", it is redundant.
+ return false;
+ }
+
// Get the key data off of disk
int data_read = file_util::ReadFile(key_file,
reinterpret_cast<char*>(&(output->at(0))),
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/owner_key_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698