Add sender NULL check in clusterProcessGossipSection invalid_ids case (#12980)

In the following case sender may be unknown, so we need to set up a
NULL check for sender:
```
/* If this is a MEET packet from an unknown node, we still process
 * the gossip section here since we have to trust the sender because
 * of the message type. */
if (!sender && type == CLUSTERMSG_TYPE_MEET)
    clusterProcessGossipSection(hdr,link);
```
This commit is contained in:
Binbin 2024-01-24 01:45:02 +08:00 committed by GitHub
parent 685409139b
commit 07b292af5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -2091,7 +2091,11 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {
* the nodes dictionary. An invalid ID indicates memory corruption on the sender side. */
int invalid_ids = verifyGossipSectionNodeIds(g, count);
if (invalid_ids) {
serverLog(LL_WARNING, "Node %.40s (%s) gossiped %d nodes with invalid IDs.", sender->name, sender->human_nodename, invalid_ids);
if (sender) {
serverLog(LL_WARNING, "Node %.40s (%s) gossiped %d nodes with invalid IDs.", sender->name, sender->human_nodename, invalid_ids);
} else {
serverLog(LL_WARNING, "Unknown node gossiped %d nodes with invalid IDs.", invalid_ids);
}
return;
}