diff options
author | Yossi Gottlieb <yossigo@gmail.com> | 2016-12-12 20:18:40 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2016-12-21 11:03:44 +0100 |
commit | 1370a888878d8e27f262eff8d4e712dc2e6ca5a6 (patch) | |
tree | 461ae7364399f39ed9d5d385cd6fb9a49adddc78 | |
parent | 68aab8e8119c37991ac7f10643503f38ad8d25a3 (diff) | |
download | redis-1370a888878d8e27f262eff8d4e712dc2e6ca5a6.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.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c index 9043915a7..2a0d7495c 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; |