summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Brubaker <cbrubaker@google.com>2015-08-12 13:40:31 -0700
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2015-10-18 22:58:08 +0200
commit3fd46c800768e463508edda867af8ecbd49d2411 (patch)
tree7ba5f8eeaec3d30fc3ae4bb4cfb8b97e0d8843f8
parentaf1ba9c30acccc199f1cfa9356916c34c52ba17f (diff)
downloadsystem_security-master.zip
system_security-master.tar.gz
system_security-master.tar.bz2
Properly check for Blob max lengthHEADmaster
sizeof(mBlob.value) is incorrect because writeBlob pads up to the next AES_BLOCK_SIZE Bug:22802399 Change-Id: I377edca2c7ea2cf4455f22f5f927fdad79893729 Tested-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
-rw-r--r--keystore/keystore.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 884b737..6b07c94 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -299,12 +299,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;