Browse Source

Apply suggestions from code review

Co-authored-by: J.C. Jones <[email protected]>
pull/1677/head
Wessel 5 months ago
committed by Wessel Nieboer
parent
commit
9b1320a899
No known key found for this signature in database GPG Key ID: 929C8E45E33B5FD2
  1. 5
      src/helpers/BaseChatMesh.cpp
  2. 5
      src/helpers/ClientACL.cpp

5
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) // 4. Store in pool (dual-decode: new key active, old key still valid)
auto entry = allocateSessionKey(from.id.pub_key); 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) { if (entry->state == SESSION_STATE_ACTIVE || entry->state == SESSION_STATE_DUAL_DECODE) {
memcpy(entry->prev_session_key, entry->session_key, SESSION_KEY_SIZE); memcpy(entry->prev_session_key, entry->session_key, SESSION_KEY_SIZE);

5
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) // 4. Store in pool (dual-decode: new key active, old key still valid)
auto entry = allocateSessionKey(client->id.pub_key); 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) { if (entry->state == SESSION_STATE_ACTIVE || entry->state == SESSION_STATE_DUAL_DECODE) {
memcpy(entry->prev_session_key, entry->session_key, SESSION_KEY_SIZE); memcpy(entry->prev_session_key, entry->session_key, SESSION_KEY_SIZE);

Loading…
Cancel
Save