summaryrefslogtreecommitdiffstats
path: root/gatekeeperd
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2016-12-07 03:46:10 -0800
committerStephen Hines <srhines@google.com>2016-12-07 03:46:55 -0800
commitb0775ca51739747be074a4b933d52da933830ed5 (patch)
tree133068fb814cce23716f5a6c3166835669421cfd /gatekeeperd
parenta79477559213e25c6a1f4bf29fc1f4a2e741f8df (diff)
downloadcore-b0775ca51739747be074a4b933d52da933830ed5.tar.gz
core-b0775ca51739747be074a4b933d52da933830ed5.tar.bz2
core-b0775ca51739747be074a4b933d52da933830ed5.zip
Switch to memcpy for accessing misaligned data.
Bug: http://b/31532493 Using misaligned pointers forces us to potentially take the address of members in a packed structure (which is now a warning/error in the latest Clang). Using memcpy() is the proper way to handle this kind of problem, as the compiler can insert the proper instructions (and usually elide the memcpy() entirely). Test: Built correctly with updated compilers. Change-Id: Ia1f6eb62cf19404ff76b71d3c6c7ffffa1403120
Diffstat (limited to 'gatekeeperd')
-rw-r--r--gatekeeperd/SoftGateKeeper.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gatekeeperd/SoftGateKeeper.h b/gatekeeperd/SoftGateKeeper.h
index 8b15d72e2..cb02a6fc6 100644
--- a/gatekeeperd/SoftGateKeeper.h
+++ b/gatekeeperd/SoftGateKeeper.h
@@ -152,7 +152,7 @@ public:
}
bool DoVerify(const password_handle_t *expected_handle, const SizedBuffer &password) {
- uint64_t user_id = android::base::get_unaligned(&expected_handle->user_id);
+ uint64_t user_id = android::base::get_unaligned<secure_id_t>(&expected_handle->user_id);
FastHashMap::const_iterator it = fast_hash_map_.find(user_id);
if (it != fast_hash_map_.end() && VerifyFast(it->second, password)) {
return true;