Skip to content

Commit eed2b39

Browse files
authored
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.
1 parent a87c7c8 commit eed2b39

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

features/FEATURE_BLE/source/generic/GenericSecurityManager.tpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,9 +883,8 @@ ble_error_t GenericSecurityManager<TPalSecurityManager, SigningMonitor>::init_si
883883
const csrk_t *pcsrk = _db->get_local_csrk();
884884
sign_count_t local_sign_counter = _db->get_local_sign_counter();
885885

886+
csrk_t csrk;
886887
if (!pcsrk) {
887-
csrk_t csrk;
888-
889888
ble_error_t ret = get_random_data(csrk.data(), csrk.size());
890889
if (ret != BLE_ERROR_NONE) {
891890
return ret;

0 commit comments

Comments
 (0)