Merge "Check corruption when reading uncrypt_status file" am: 3cf815a6a9 am: 40bae5e1c6
am: 1d55666106
Change-Id: I2081d6803377a7bf26175a55b3b5defb7c9d09d1
diff --git a/install.cpp b/install.cpp
index d8073c5..71ad71f 100644
--- a/install.cpp
+++ b/install.cpp
@@ -543,6 +543,8 @@
std::string uncrypt_status;
if (!android::base::ReadFileToString(UNCRYPT_STATUS, &uncrypt_status)) {
PLOG(WARNING) << "failed to read uncrypt status";
+ } else if (!android::base::StartsWith(uncrypt_status, "uncrypt_time:")) {
+ PLOG(WARNING) << "corrupted uncrypt_status: " << uncrypt_status;
} else {
fprintf(install_log, "%s\n", android::base::Trim(uncrypt_status).c_str());
}