From 0d1db30fbddbbc032b252b58a003ca3171016ff8 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Mon, 8 Jul 2024 20:06:02 +0000 Subject: fix left computation --- server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3