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

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: 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
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..ef450b5583822a1c3f52a24e00e2b0e8afe65c0e 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.";
+ return true;
Mattias Nissler (ping if slow) 2012/05/21 14:33:27 It seems returning true here is actually the wrong
pastarmovj 2012/05/21 14:38:23 This was intentional as can be seen from the unit
Mattias Nissler (ping if slow) 2012/05/21 15:14:28 Have you checked the caller? A quick look in Owner
pastarmovj 2012/05/21 16:26:02 Changed as discussed.
+ }
+
// Get the key data off of disk
int data_read = file_util::ReadFile(key_file,
reinterpret_cast<char*>(&(output->at(0))),

Powered by Google App Engine
This is Rietveld 408576698