From 1c1864f321b129c81883ed527b1da8c69661e51f Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Mon, 12 Sep 2016 16:43:37 -0700 Subject: Check corruption when reading uncrypt_status file Bug: 31383361 Change-Id: I0de920916da213528d73b742e4823b4a98c63ea1 --- install.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install.cpp b/install.cpp index fac6151b3..4c697420f 100644 --- a/install.cpp +++ b/install.cpp @@ -392,6 +392,8 @@ install_package(const char* path, bool* wipe_cache, const char* install_file, 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()); } -- cgit v1.2.3