From b4520aaf2cb56cd14519e2df9d99ea6efc8ddd03 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 16 Dec 2019 16:09:28 +0000 Subject: Need to include message size in the maximum buffer calculation. --- client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index 38fe52cd..a36c6471 100644 --- a/client.c +++ b/client.c @@ -601,8 +601,8 @@ client_read_callback(__unused struct bufferevent *bev, void *arg) if (bsize == 0) break; - if (bsize > MAX_IMSGSIZE - IMSG_HEADER_SIZE) - bsize = MAX_IMSGSIZE - IMSG_HEADER_SIZE; + if (bsize > MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof *msg) + bsize = MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof *msg; log_debug("read %zu from file %d", bsize, cf->stream); msglen = (sizeof *msg) + bsize; -- cgit