Check corruption when reading uncrypt_status file

am: 41a3fd4e20

Change-Id: I19d9b6605d75d636eef0c770979b9f71c2e6a7f2
This commit is contained in:
Tianjie Xu
2016-09-13 22:45:34 +00:00
committed by android-build-merger
+2
View File
@@ -548,6 +548,8 @@ install_package(const char* path, bool* wipe_cache, const char* install_file,
std::string uncrypt_status; std::string uncrypt_status;
if (!android::base::ReadFileToString(UNCRYPT_STATUS, &uncrypt_status)) { if (!android::base::ReadFileToString(UNCRYPT_STATUS, &uncrypt_status)) {
PLOG(WARNING) << "failed to read 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 { } else {
fprintf(install_log, "%s\n", android::base::Trim(uncrypt_status).c_str()); fprintf(install_log, "%s\n", android::base::Trim(uncrypt_status).c_str());
} }