Skip to content

Commit ab60655

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

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

12641264
// 4. Store in pool (dual-decode: new key active, old key still valid)
12651265
auto entry = allocateSessionKey(from.id.pub_key);
1266-
if (!entry) return 0;
1266+
if (!entry) {
1267+
memset(new_session_key, 0, SESSION_KEY_SIZE);
1268+
return 0;
1269+
}
12671270

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