Skip to content

Commit 49005ca

Browse files
weebl2000jcjones
andcommitted
Apply suggestions from code review
Co-authored-by: J.C. Jones <james.jc.jones@gmail.com>
1 parent b868b93 commit 49005ca

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/helpers/BaseChatMesh.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,10 @@ uint8_t BaseChatMesh::handleIncomingSessionKeyInit(ContactInfo& from, const uint
13211321

13221322
// 4. Store in pool (dual-decode: new key active, old key still valid)
13231323
auto entry = allocateSessionKey(from.id.pub_key);
1324-
if (!entry) return 0;
1324+
if (!entry) {
1325+
memset(new_session_key, 0, SESSION_KEY_SIZE);
1326+
return 0;
1327+
}
13251328

13261329
if (entry->state == SESSION_STATE_ACTIVE || entry->state == SESSION_STATE_DUAL_DECODE) {
13271330
memcpy(entry->prev_session_key, entry->session_key, SESSION_KEY_SIZE);

src/helpers/ClientACL.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,10 @@ int ClientACL::handleSessionKeyInit(const ClientInfo* client, const uint8_t* eph
264264

265265
// 4. Store in pool (dual-decode: new key active, old key still valid)
266266
auto entry = allocateSessionKey(client->id.pub_key);
267-
if (!entry) return 0;
267+
if (!entry) {
268+
memset(new_session_key, 0, SESSION_KEY_SIZE);
269+
return 0;
270+
}
268271

269272
if (entry->state == SESSION_STATE_ACTIVE || entry->state == SESSION_STATE_DUAL_DECODE) {
270273
memcpy(entry->prev_session_key, entry->session_key, SESSION_KEY_SIZE);

0 commit comments

Comments
 (0)