From 4e5e0d3719ffed0d3a687fa2082655f97e16167c Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 4 Sep 2018 13:29:24 +0200 Subject: [PATCH] Clarify why remaining may be zero in readQueryFromClient(). See #5304. --- src/networking.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/networking.c b/src/networking.c index 605621c1c..01307c7a3 100644 --- a/src/networking.c +++ b/src/networking.c @@ -1466,6 +1466,8 @@ void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) { { ssize_t remaining = (size_t)(c->bulklen+2)-sdslen(c->querybuf); + /* Note that the 'remaining' variable may be zero in some edge case, + * for example once we resume a blocked client after CLIENT PAUSE. */ if (remaining > 0 && remaining < readlen) readlen = remaining; }