summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordejun.xdj <dejun.xdj@alibaba-inc.com>2018-05-21 12:06:48 +0800
committerantirez <antirez@gmail.com>2018-05-29 12:46:27 +0200
commitc7197ff50f09d9e27d65f06964a17767f1ec3afc (patch)
treee2d5f967541bfe5eac378af54c34ed6e5bf73a17
parent3f77777ffd98f4d5686c8ed5ae883b1834021c77 (diff)
downloadredis-c7197ff50f09d9e27d65f06964a17767f1ec3afc.tar.gz
Check if the repeat value is positive in while loop of cliSendCommand().
In case that the incoming repeat parameter is negative and causes a deadless loop.
-rw-r--r--src/redis-cli.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 6ae25e8ba..f10382ed9 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -980,7 +980,7 @@ static int cliSendCommand(int argc, char **argv, long repeat) {
for (j = 0; j < argc; j++)
argvlen[j] = sdslen(argv[j]);
- while(repeat--) {
+ while(repeat-- > 0) {
redisAppendCommandArgv(context,argc,(const char**)argv,argvlen);
while (config.monitor_mode) {
if (cliReadReply(output_raw) != REDIS_OK) exit(1);