diff options
author | Chad Brubaker <cbrubaker@google.com> | 2015-08-12 13:40:31 -0700 |
---|---|---|
committer | Brint E. Kriebel <bekit@cyngn.com> | 2015-10-05 15:20:45 -0700 |
commit | f991292f49c4717b9d0ec97f8a28863f52ef4a7b (patch) | |
tree | cb07329d4656242cdacef40862128275d9dfb7b4 | |
parent | 7feb98e653737755094b83b9e7cee27847af1edc (diff) | |
download | android_system_security-stable/cm-12.1-YOG4P.tar.gz android_system_security-stable/cm-12.1-YOG4P.tar.bz2 android_system_security-stable/cm-12.1-YOG4P.zip |
Properly check for Blob max lengthstable/cm-12.1-YOG4P
sizeof(mBlob.value) is incorrect because writeBlob pads up to the next
AES_BLOCK_SIZE
Bug:22802399
Change-Id: I377edca2c7ea2cf4455f22f5f927fdad79893729
Ticket: CYNGNOS-985
-rw-r--r-- | keystore/keystore.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp index 58d2fd6..4fdd593 100644 --- a/keystore/keystore.cpp +++ b/keystore/keystore.cpp @@ -487,12 +487,12 @@ class Blob { public: Blob(const uint8_t* value, size_t valueLength, const uint8_t* info, uint8_t infoLength, BlobType type) { - if (valueLength > sizeof(mBlob.value)) { - valueLength = sizeof(mBlob.value); + if (valueLength > VALUE_SIZE) { + valueLength = VALUE_SIZE; ALOGW("Provided blob length too large"); } - if (infoLength + valueLength > sizeof(mBlob.value)) { - infoLength = sizeof(mBlob.value) - valueLength; + if (infoLength + valueLength > VALUE_SIZE) { + infoLength = VALUE_SIZE - valueLength; ALOGW("Provided info length too large"); } mBlob.length = valueLength; |