diff options
author | Oran Agra <oran@redislabs.com> | 2021-05-06 17:45:49 +0300 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2021-06-01 17:03:36 +0300 |
commit | 840f7f61c5aef39c47f0a8b6bc993956f66dc97c (patch) | |
tree | dac06e32ee10936db88070baa2271bd1d7807443 | |
parent | 9d69d6e8fba82115fac935609fb716e60d72c6fa (diff) | |
download | redis-840f7f61c5aef39c47f0a8b6bc993956f66dc97c.tar.gz |
fix redis-benchmark to ignore unsupported configs (#8916)
Redis Enterprise supports the CONFIG GET command, but it replies with am
empty array since the save and appendonly configs are not supported.
before this fix redis-benchmark would segfault for trying to access the
error string on an array type reply.
see #8869
(cherry picked from commit 4d1094e8be3150b92b3e96d3a743c66b1a95988a)
-rw-r--r-- | src/redis-benchmark.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index fa024d44f..8d510d7da 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -368,9 +368,10 @@ fail: if (hostsocket == NULL) fprintf(stderr, "%s:%d\n", ip, port); else fprintf(stderr, "%s\n", hostsocket); int abort_test = 0; - if (!strncmp(reply->str,"NOAUTH",5) || - !strncmp(reply->str,"WRONGPASS",9) || - !strncmp(reply->str,"NOPERM",5)) + if (reply && reply->type == REDIS_REPLY_ERROR && + (!strncmp(reply->str,"NOAUTH",5) || + !strncmp(reply->str,"WRONGPASS",9) || + !strncmp(reply->str,"NOPERM",5))) abort_test = 1; freeReplyObject(reply); redisFree(c); |