Skip to content

Commit f842d2d

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

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
@@ -1333,7 +1333,10 @@ uint8_t BaseChatMesh::handleIncomingSessionKeyInit(ContactInfo& from, const uint
13331333

13341334
// 4. Store in pool (dual-decode: new key active, old key still valid)
13351335
auto entry = allocateSessionKey(from.id.pub_key);
1336-
if (!entry) return 0;
1336+
if (!entry) {
1337+
memset(new_session_key, 0, SESSION_KEY_SIZE);
1338+
return 0;
1339+
}
13371340

13381341
if (entry->state == SESSION_STATE_ACTIVE || entry->state == SESSION_STATE_DUAL_DECODE) {
13391342
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)