From d281de75ad4c8c5ab0c5b3ac12de0c26e7ba8fbc Mon Sep 17 00:00:00 2001 From: Paul Crowley Date: Thu, 30 Aug 2018 15:25:19 -0700 Subject: [PATCH] Fix unaligned access to auth token user_id Bug: 65232288 Test: Set a pattern on cuttlefish, ensure we can unlock Change-Id: I5ee09cf72ab7d3d636a25755134bfad6f88265f9 --- KeyStorage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KeyStorage.cpp b/KeyStorage.cpp index a7582c2..951536b 100644 --- a/KeyStorage.cpp +++ b/KeyStorage.cpp @@ -122,7 +122,8 @@ static bool generateKeymasterKey(Keymaster& keymaster, const KeyAuthentication& return false; } const hw_auth_token_t* at = reinterpret_cast(auth.token.data()); - paramBuilder.Authorization(km::TAG_USER_SECURE_ID, at->user_id); + auto user_id = at->user_id; // Make a copy because at->user_id is unaligned. + paramBuilder.Authorization(km::TAG_USER_SECURE_ID, user_id); paramBuilder.Authorization(km::TAG_USER_AUTH_TYPE, km::HardwareAuthenticatorType::PASSWORD); paramBuilder.Authorization(km::TAG_AUTH_TIMEOUT, AUTH_TIMEOUT); }