From 5e0261c0ebcd94848de436f52844cd3e3ba9a6f6 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 9bbea0fe2..feddf378c 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);