mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
a87c7c82f3
commit
eed2b390d9
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue