diff --git a/libwvdrmengine/oemcrypto/odk/src/core_message_serialize.cpp b/libwvdrmengine/oemcrypto/odk/src/core_message_serialize.cpp index 334f4429..a33e242e 100644 --- a/libwvdrmengine/oemcrypto/odk/src/core_message_serialize.cpp +++ b/libwvdrmengine/oemcrypto/odk/src/core_message_serialize.cpp @@ -13,6 +13,7 @@ #include "odk_serialize.h" #include "odk_structs.h" #include "odk_structs_priv.h" +#include "odk_target.h" #include "serialization_base.h" namespace oemcrypto_core_message { @@ -122,6 +123,9 @@ bool CreateCoreLicenseResponse(const CoreMessageFeatures& features, license_response)) { return false; } + if (ODK_MAX_NUM_KEYS < license_response.parsed_license->key_array_length) { + return false; + } if (license_response.request.core_message.nonce_values.api_major_version == 16) { ODK_LicenseResponseV16 license_response_v16; @@ -143,7 +147,8 @@ bool CreateCoreLicenseResponse(const CoreMessageFeatures& features, license_response_v16.parsed_license.key_array_length = license_response.parsed_license->key_array_length; uint32_t i; - for (i = 0; i < license_response_v16.parsed_license.key_array_length; i++) { + for (i = 0; i < license_response_v16.parsed_license.key_array_length && + i < license_response.parsed_license->key_array_length; i++) { license_response_v16.parsed_license.key_array[i] = license_response.parsed_license->key_array[i]; }