Dead pointer usage in GenericSecurityManager

`pscrk` is set to the address of `csrk`, but `csrk` is out of scope when using the resulting value. There's no guarantee that the memory is still valid.
pull/9980/head
Jan Jongboom 2019-03-07 16:21:52 +01:00 committed by GitHub
parent a87c7c82f3
commit eed2b390d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -883,9 +883,8 @@ ble_error_t GenericSecurityManager<TPalSecurityManager, SigningMonitor>::init_si
const csrk_t *pcsrk = _db->get_local_csrk(); const csrk_t *pcsrk = _db->get_local_csrk();
sign_count_t local_sign_counter = _db->get_local_sign_counter(); sign_count_t local_sign_counter = _db->get_local_sign_counter();
csrk_t csrk;
if (!pcsrk) { if (!pcsrk) {
csrk_t csrk;
ble_error_t ret = get_random_data(csrk.data(), csrk.size()); ble_error_t ret = get_random_data(csrk.data(), csrk.size());
if (ret != BLE_ERROR_NONE) { if (ret != BLE_ERROR_NONE) {
return ret; return ret;