summaryrefslogtreecommitdiff
path: root/ng/AndroidSharedSecret.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ng/AndroidSharedSecret.cpp')
-rw-r--r--ng/AndroidSharedSecret.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/ng/AndroidSharedSecret.cpp b/ng/AndroidSharedSecret.cpp
index 0ae3d2d..c800666 100644
--- a/ng/AndroidSharedSecret.cpp
+++ b/ng/AndroidSharedSecret.cpp
@@ -44,7 +44,11 @@ ScopedAStatus AndroidSharedSecret::getSharedSecretParameters(SharedSecretParamet
ScopedAStatus AndroidSharedSecret::computeSharedSecret(const vector<SharedSecretParameters>& params,
vector<uint8_t>* sharingCheck) {
ComputeSharedHmacRequest request(impl_->message_version());
- request.params_array.params_array = new keymaster::HmacSharingParameters[params.size()];
+ request.params_array.params_array =
+ new (std::nothrow) keymaster::HmacSharingParameters[params.size()];
+ if (request.params_array.params_array == nullptr) {
+ return kmError2ScopedAStatus(KM_ERROR_MEMORY_ALLOCATION_FAILED);
+ }
request.params_array.num_params = params.size();
for (size_t i = 0; i < params.size(); ++i) {
request.params_array.params_array[i].seed = {params[i].seed.data(), params[i].seed.size()};