From 727dd43614ec45e23e2dedbba08b393323feaa4f Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 18 Jan 2018 12:41:05 +0100 Subject: [PATCH] Fix migrateCommand() access of not initialized byte. --- src/cluster.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cluster.c b/src/cluster.c index 97d311e1b..00fa5d4a2 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -5086,12 +5086,15 @@ try_again: socket_error = 1; break; } - if (buf0[0] == '-' || (select && buf1[0] == '-') || buf2[0] == '-') { + if ((password && buf0[0] == '-') || + (select && buf1[0] == '-') || + buf2[0] == '-') + { /* On error assume that last_dbid is no longer valid. */ if (!error_from_target) { cs->last_dbid = -1; char *errbuf; - if (buf0[0] == '-') errbuf = buf0; + if (password && buf0[0] == '-') errbuf = buf0; else if (select && buf1[0] == '-') errbuf = buf1; else errbuf = buf2;