mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:09:42 +00:00
Merge "KeyMint VTS: don't crash on invalid patchlevel" am: e1152b6390 am: 4e9cab823d am: 69d66e13db am: b8dfd10b9b
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1844900 Change-Id: I2d26ac35e5f6bf16ec8aaa5825bc849507347a01
This commit is contained in:
@@ -1365,11 +1365,16 @@ bool verify_attestation_record(const string& challenge, //
|
|||||||
att_hw_enforced[i].tag == TAG_VENDOR_PATCHLEVEL) {
|
att_hw_enforced[i].tag == TAG_VENDOR_PATCHLEVEL) {
|
||||||
std::string date =
|
std::string date =
|
||||||
std::to_string(att_hw_enforced[i].value.get<KeyParameterValue::integer>());
|
std::to_string(att_hw_enforced[i].value.get<KeyParameterValue::integer>());
|
||||||
|
|
||||||
// strptime seems to require delimiters, but the tag value will
|
// strptime seems to require delimiters, but the tag value will
|
||||||
// be YYYYMMDD
|
// be YYYYMMDD
|
||||||
|
if (date.size() != 8) {
|
||||||
|
ADD_FAILURE() << "Tag " << att_hw_enforced[i].tag
|
||||||
|
<< " with invalid format (not YYYYMMDD): " << date;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
date.insert(6, "-");
|
date.insert(6, "-");
|
||||||
date.insert(4, "-");
|
date.insert(4, "-");
|
||||||
EXPECT_EQ(date.size(), 10);
|
|
||||||
struct tm time;
|
struct tm time;
|
||||||
strptime(date.c_str(), "%Y-%m-%d", &time);
|
strptime(date.c_str(), "%Y-%m-%d", &time);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user