mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 19:02:00 +00:00
Skip empty channel slots in searchChannelsByHash
An unconfigured slot has an all-zero secret, so it matches null-key group traffic (a sender with an unset PSK). The zero-key MAC validates against the empty slot and the foreign message is delivered as if it belonged to that channel — every node with a free slot is a null-key sink. Skip empty slots.
This commit is contained in:
@@ -368,6 +368,12 @@ void BaseChatMesh::handleReturnPathRetry(const ContactInfo& contact, const uint8
|
|||||||
int BaseChatMesh::searchChannelsByHash(const uint8_t* hash, mesh::GroupChannel dest[], int max_matches) {
|
int BaseChatMesh::searchChannelsByHash(const uint8_t* hash, mesh::GroupChannel dest[], int max_matches) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int i = 0; i < MAX_GROUP_CHANNELS && n < max_matches; i++) {
|
for (int i = 0; i < MAX_GROUP_CHANNELS && n < max_matches; i++) {
|
||||||
|
// Skip empty/unconfigured slots. An empty slot has an all-zero secret and
|
||||||
|
// therefore matches null-key group traffic (a node transmitting with an
|
||||||
|
// unset PSK): the zero-key MAC validates against the empty slot and the
|
||||||
|
// foreign message is delivered as if it belonged to that channel. Any node
|
||||||
|
// with a free channel slot would otherwise act as a null-key sink.
|
||||||
|
if (channels[i].name[0] == 0) continue;
|
||||||
if (channels[i].channel.hash[0] == hash[0]) {
|
if (channels[i].channel.hash[0] == hash[0]) {
|
||||||
dest[n++] = channels[i].channel;
|
dest[n++] = channels[i].channel;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user