am a8f5bbbe: am 54b1e9ad: Properly check for Blob max length
* commit 'a8f5bbbee318cf3dc0272a80a59eb6c0d537c692':
Properly check for Blob max length
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 8a43f02..65a8ea9 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -508,12 +508,12 @@
Blob(const uint8_t* value, size_t valueLength, const uint8_t* info, uint8_t infoLength,
BlobType type) {
memset(&mBlob, 0, sizeof(mBlob));
- 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;