From 1d8078b7f19176f674b84fdad84c45851b12c532 Mon Sep 17 00:00:00 2001 From: David Cavar Date: Tue, 9 Feb 2016 15:04:42 +0100 Subject: [PATCH] Reverse redirect address parse Fix issue in case the redirect address is in ipv6 format. Parse from behind to extract last part of the response which represents actual port. --- 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 93a09005..8b2b666e 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -598,7 +598,7 @@ static int cliReadReply(int output_raw_strings) { p = strchr(s+1,' '); /* MOVED[S]3999[P]127.0.0.1:6381 */ *p = '\0'; slot = atoi(s+1); - s = strchr(p+1,':'); /* MOVED 3999[P]127.0.0.1[S]6381 */ + s = strrchr(p+1,':'); /* MOVED 3999[P]127.0.0.1[S]6381 */ *s = '\0'; sdsfree(config.hostip); config.hostip = sdsnew(p+1);