mirror of https://mirror.osredm.com/root/redis.git
Ensure validity of myself as master or replica when loading cluster config (#13443)
First, we need to ensure that `curmaster` in `clusterUpdateSlotsConfigWith()` is not NULL in the line82f00f5179/src/cluster_legacy.c (L2320)
otherwise, it will crash in the82f00f5179/src/cluster_legacy.c (L2395)
So when loading cluster node config, we need to ensure that the following conditions are met: 1. A node must be at least one of the master or replica. 2. If a node is a replica, its master can't be NULL.
This commit is contained in:
parent
e4ddc34463
commit
bf643a63c8
|
@ -634,6 +634,8 @@ int clusterLoadConfig(char *filename) {
|
|||
}
|
||||
/* Config sanity check */
|
||||
if (server.cluster->myself == NULL) goto fmterr;
|
||||
if (!(myself->flags & (CLUSTER_NODE_MASTER | CLUSTER_NODE_SLAVE))) goto fmterr;
|
||||
if (nodeIsSlave(myself) && myself->slaveof == NULL) goto fmterr;
|
||||
|
||||
zfree(line);
|
||||
fclose(fp);
|
||||
|
|
Loading…
Reference in New Issue