diff options
author | Chen, Luhai <luhai.chen@intel.com> | 2017-08-18 14:49:45 +0800 |
---|---|---|
committer | Gaurav Sarode <sgaurav@google.com> | 2017-09-11 18:39:01 -0700 |
commit | 5744dfe3cc9bf7caa8a297f87528419979b138ff (patch) | |
tree | 89ab8d5f60652363b0d6b1452104709df4fd3690 | |
parent | 7056de1b423e10b16149df3db0102aff714f2648 (diff) | |
download | android_system_vold-5744dfe3cc9bf7caa8a297f87528419979b138ff.tar.gz android_system_vold-5744dfe3cc9bf7caa8a297f87528419979b138ff.tar.bz2 android_system_vold-5744dfe3cc9bf7caa8a297f87528419979b138ff.zip |
Fix keyname generation issue
The keyname binded to keyring return a wrong string when there are binary char larger than 127,
the sign extension will introduce unexpect FFFFFF string to the keyname.
Bug: 65423023
Test: local build with boot test and device encryption status check.
Change-Id: I26482c98ac1858a63b9f5c3f84a8699fd6a21cd7
Signed-off-by: Ai, Ting A <ting.a.ai@intel.com>
Signed-off-by: Chen, Luhai <luhai.chen@intel.com>
-rw-r--r-- | KeyUtil.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/KeyUtil.cpp b/KeyUtil.cpp index 7bbbf01..dbc73c1 100644 --- a/KeyUtil.cpp +++ b/KeyUtil.cpp @@ -98,7 +98,7 @@ static char const* const NAME_PREFIXES[] = { static std::string keyname(const std::string& prefix, const std::string& raw_ref) { std::ostringstream o; o << prefix << ":"; - for (auto i : raw_ref) { + for (unsigned char i : raw_ref) { o << std::hex << std::setw(2) << std::setfill('0') << (int)i; } return o.str(); |