summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-09-04 13:29:24 +0200
committerantirez <antirez@gmail.com>2018-09-05 19:55:38 +0200
commita0dd6f822bffe0851b70a4f86de661a4b2aa1439 (patch)
tree89ab60abdeed21c51968474ae176233a6a85979d
parent2eed31a59ed92cb05ac08d95fffc02d45deb2542 (diff)
downloadredis-a0dd6f822bffe0851b70a4f86de661a4b2aa1439.tar.gz
Clarify why remaining may be zero in readQueryFromClient().
See #5304.
-rw-r--r--src/networking.c2
1 files changed, 2 insertions, 0 deletions
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;
}