summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Gottlieb <yossigo@gmail.com>2016-12-12 20:18:40 +0200
committerYossi Gottlieb <yossigo@gmail.com>2016-12-12 20:18:40 +0200
commitb6ab4d04b60548fcc5c04d2da53a8af0c3d59593 (patch)
tree8d8e8a637b3c8266c5813acb40fb52e1370fff86
parent978a790b85f240615486913db1d043d28e51b74b (diff)
downloadredis-b6ab4d04b60548fcc5c04d2da53a8af0c3d59593.tar.gz
Fix redis-cli rare crash.
This happens if the server (mysteriously) returns an unexpected response to the COMMAND command.
-rw-r--r--src/redis-cli.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 85ca404fb..ac4358220 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -275,6 +275,10 @@ static void cliIntegrateHelp(void) {
* don't already match what we have. */
for (size_t j = 0; j < reply->elements; j++) {
redisReply *entry = reply->element[j];
+ if (entry->type != REDIS_REPLY_ARRAY || entry->elements < 4 ||
+ entry->element[0]->type != REDIS_REPLY_STRING ||
+ entry->element[1]->type != REDIS_REPLY_INTEGER ||
+ entry->element[3]->type != REDIS_REPLY_INTEGER) return;
char *cmdname = entry->element[0]->str;
int i;