BLE: Fix SM random number generation.

Ensure the more than 8 random bytes are fetched from the stack.
pull/14125/head
Vincent Coubard 2021-01-07 12:38:47 +00:00
parent b28e11574a
commit 4cfcadd9e9
1 changed files with 1 additions and 1 deletions

View File

@ -1125,7 +1125,7 @@ ble_error_t SecurityManager::get_random_data(uint8_t *buffer, size_t size)
while (size) {
/* fill out the buffer by reading the random data in chunks
* and copying it until reaching the set size */
size_t copy_size = std::max(size, random_data.size());
size_t copy_size = std::min(size, random_data.size());
ble_error_t ret = _pal.get_random_data(random_data);
if (ret != BLE_ERROR_NONE) {
return ret;