diff --git a/src/cluster.c b/src/cluster.c index a9fedce0..2da0f54f 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -243,6 +243,7 @@ int clusterLoadConfig(char *filename) { *p = '\0'; direction = p[1]; /* Either '>' or '<' */ slot = atoi(argv[j]+1); + if (slot < 0 || slot >= CLUSTER_SLOTS) goto fmterr; p += 3; cn = clusterLookupNode(p); if (!cn) { @@ -262,6 +263,8 @@ int clusterLoadConfig(char *filename) { } else { start = stop = atoi(argv[j]); } + if (start < 0 || start >= CLUSTER_SLOTS) goto fmterr; + if (stop < 0 || stop >= CLUSTER_SLOTS) goto fmterr; while(start <= stop) clusterAddSlot(n, start++); }