From c7197ff50f09d9e27d65f06964a17767f1ec3afc Mon Sep 17 00:00:00 2001 From: "dejun.xdj" Date: Mon, 21 May 2018 12:06:48 +0800 Subject: [PATCH] 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. --- src/redis-cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index 6ae25e8b..f10382ed 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);