diff --git a/src/helpers/BaseChatMesh.cpp b/src/helpers/BaseChatMesh.cpp index 8cf942e44..b6a062937 100644 --- a/src/helpers/BaseChatMesh.cpp +++ b/src/helpers/BaseChatMesh.cpp @@ -1345,7 +1345,10 @@ uint8_t BaseChatMesh::handleIncomingSessionKeyInit(ContactInfo& from, const uint // 4. Store in pool (dual-decode: new key active, old key still valid) auto entry = allocateSessionKey(from.id.pub_key); - if (!entry) return 0; + if (!entry) { + memset(new_session_key, 0, SESSION_KEY_SIZE); + return 0; + } if (entry->state == SESSION_STATE_ACTIVE || entry->state == SESSION_STATE_DUAL_DECODE) { memcpy(entry->prev_session_key, entry->session_key, SESSION_KEY_SIZE); diff --git a/src/helpers/ClientACL.cpp b/src/helpers/ClientACL.cpp index fae658aa5..46ddea575 100644 --- a/src/helpers/ClientACL.cpp +++ b/src/helpers/ClientACL.cpp @@ -264,7 +264,10 @@ int ClientACL::handleSessionKeyInit(const ClientInfo* client, const uint8_t* eph // 4. Store in pool (dual-decode: new key active, old key still valid) auto entry = allocateSessionKey(client->id.pub_key); - if (!entry) return 0; + if (!entry) { + memset(new_session_key, 0, SESSION_KEY_SIZE); + return 0; + } if (entry->state == SESSION_STATE_ACTIVE || entry->state == SESSION_STATE_DUAL_DECODE) { memcpy(entry->prev_session_key, entry->session_key, SESSION_KEY_SIZE);