summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBinbin <binloveplay1314@qq.com>2021-07-06 15:46:10 +0800
committerGitHub <noreply@github.com>2021-07-06 10:46:10 +0300
commit3a26f61fb35ff9f96da8b7d0ba7d5f8c73e46da5 (patch)
tree03aec93745634d450f30154220a9a9ba9b5a5694
parent5ea3c3db15ad2b67ae3c027ba8f10f3ea19d18f9 (diff)
downloadredis-3a26f61fb35ff9f96da8b7d0ba7d5f8c73e46da5.tar.gz
Add range check for master port in replicaof. (#9201)
So that we can avoid commands that are obviously wrong. Also unified with loadServerConfigFromString because we also checked the range.
-rw-r--r--src/replication.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/replication.c b/src/replication.c
index 06934a7bb..65e6d9b08 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -2777,7 +2777,8 @@ void replicaofCommand(client *c) {
return;
}
- if ((getLongFromObjectOrReply(c, c->argv[2], &port, NULL) != C_OK))
+ if (getRangeLongFromObjectOrReply(c, c->argv[2], 0, 65535, &port,
+ "Invalid master port") != C_OK)
return;
/* Check if we are already attached to the specified master */