diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2019-03-19 00:25:52 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-03-19 00:25:52 +0000 |
commit | 8aa059438d440eeea30a7a92e8a79813135fe627 (patch) | |
tree | 20f765fc38165be12aafddd053cec80147c67939 /libkeyutils/mini_keyctl_utils.cpp | |
parent | e16a253cb026df13a3d33811ae2b145e251cdc16 (diff) | |
parent | 0fb290bb8aa46b6cb5e8790be7fbcec0a00876a9 (diff) |
Merge "mini-keyctl: use ParseInt to parse keys"
Diffstat (limited to 'libkeyutils/mini_keyctl_utils.cpp')
-rw-r--r-- | libkeyutils/mini_keyctl_utils.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libkeyutils/mini_keyctl_utils.cpp b/libkeyutils/mini_keyctl_utils.cpp index 1c80ffb8e4..9fe2dfef1d 100644 --- a/libkeyutils/mini_keyctl_utils.cpp +++ b/libkeyutils/mini_keyctl_utils.cpp @@ -30,6 +30,7 @@ #include <android-base/file.h> #include <android-base/logging.h> +#include <android-base/parseint.h> #include <android-base/properties.h> #include <android-base/strings.h> #include <keyutils.h> @@ -53,12 +54,8 @@ static bool GetKeyringId(const std::string& keyring_desc, key_serial_t* keyring_ } // If the keyring id is already a hex number, directly convert it to keyring id - try { - key_serial_t id = std::stoi(keyring_desc, nullptr, 16); - *keyring_id = id; + if (android::base::ParseInt(keyring_desc.c_str(), keyring_id)) { return true; - } catch (const std::exception& e) { - LOG(INFO) << "search /proc/keys for keyring id"; } // Only keys allowed by SELinux rules will be shown here. |