aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/server.c b/server.c
index b8e4479..5324d62 100644
--- a/server.c
+++ b/server.c
@@ -1310,7 +1310,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, void *cb_arg)
if (c->buf.has_tail) {
/* we have leftover data from a previous call to read_cb */
- size_t left = BUFLAYER_MAX - c->buf.read_pos;
+ size_t left = c->buf.len - c->buf.read_pos;
size_t copy_len = MINIMUM(buflen, left);
memcpy(buf, c->buf.data + c->buf.read_pos, copy_len);