Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8dfd10b authored by David Drysdale's avatar David Drysdale Committed by Automerger Merge Worker
Browse files

Merge "KeyMint VTS: don't crash on invalid patchlevel" am: e1152b63 am: 4e9cab82 am: 69d66e13

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1844900

Change-Id: Ifa9c2210c18cc0000a63cd8d16b02f4d71e16256
parents 3d6cd17f 69d66e13
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1365,11 +1365,16 @@ bool verify_attestation_record(const string& challenge, //
                att_hw_enforced[i].tag == TAG_VENDOR_PATCHLEVEL) {
                std::string date =
                        std::to_string(att_hw_enforced[i].value.get<KeyParameterValue::integer>());

                // strptime seems to require delimiters, but the tag value will
                // 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(4, "-");
                EXPECT_EQ(date.size(), 10);
                struct tm time;
                strptime(date.c_str(), "%Y-%m-%d", &time);