Unverified Commit 3a26f61f authored by Binbin's avatar Binbin Committed by GitHub
Browse files

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.
parent 5ea3c3db
...@@ -2777,7 +2777,8 @@ void replicaofCommand(client *c) { ...@@ -2777,7 +2777,8 @@ void replicaofCommand(client *c) {
return; 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; return;
/* Check if we are already attached to the specified master */ /* Check if we are already attached to the specified master */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment