diff options
author | Jing-yan, Jang <josephjang@google.com> | 2020-07-07 12:07:36 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-07-07 12:07:36 +0000 |
commit | 32cbc59c81949483e21f4fa4677257a8e36452bc (patch) | |
tree | 1da46562956d8699e131bbe8b475a10f0fb70a8e | |
parent | ef7bf24010d72eaf71580eb594e1e6a2882894e8 (diff) | |
parent | 4feb8cd28404a5aa8a65cfa8ca00c63816eb0e2a (diff) | |
download | platform_hardware_interfaces-32cbc59c81949483e21f4fa4677257a8e36452bc.tar.gz platform_hardware_interfaces-32cbc59c81949483e21f4fa4677257a8e36452bc.tar.bz2 platform_hardware_interfaces-32cbc59c81949483e21f4fa4677257a8e36452bc.zip |
Merge "Keymaster: Fix potential bug in extractUint32()/extractUint64()" into rvc-dev
-rw-r--r-- | keymaster/4.0/support/keymaster_utils.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/keymaster/4.0/support/keymaster_utils.cpp b/keymaster/4.0/support/keymaster_utils.cpp index 366cd0e553..bcfa75729a 100644 --- a/keymaster/4.0/support/keymaster_utils.cpp +++ b/keymaster/4.0/support/keymaster_utils.cpp @@ -121,8 +121,8 @@ void appendUint64(std::vector<uint8_t>& vec, uint64_t value) { uint64_t extractUint64(const std::vector<uint8_t>& data, size_t offset) { uint64_t value = 0; for (size_t n = 0; n < sizeof(uint64_t); n++) { - uint8_t byte = data[offset + n]; - value |= byte << (n * 8); + uint64_t tmp = data[offset + n]; + value |= (tmp << (n * 8)); } return value; } @@ -137,8 +137,8 @@ void appendUint32(std::vector<uint8_t>& vec, uint32_t value) { uint32_t extractUint32(const std::vector<uint8_t>& data, size_t offset) { uint32_t value = 0; for (size_t n = 0; n < sizeof(uint32_t); n++) { - uint8_t byte = data[offset + n]; - value |= byte << (n * 8); + uint32_t tmp = data[offset + n]; + value |= (tmp << (n * 8)); } return value; } |