aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2024-07-08 20:06:02 +0000
committerOmar Polo <op@omarpolo.com>2024-07-08 20:06:02 +0000
commit0d1db30fbddbbc032b252b58a003ca3171016ff8 (patch)
tree9c7690387f3d872e2814d3e3457eb7d0fdbdd269
parent502817ef1461c78e8bbac34a4e5b33e17f1a84fd (diff)
fix left computation
-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);