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. --- file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index 7e1f1879..9a3e79de 100644 --- a/file.c +++ b/file.c @@ -376,8 +376,8 @@ file_push(struct client_file *cf) left = EVBUFFER_LENGTH(cf->buffer); while (left != 0) { sent = left; - if (sent > MAX_IMSGSIZE - IMSG_HEADER_SIZE) - sent = MAX_IMSGSIZE - IMSG_HEADER_SIZE; + if (sent > MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof *msg) + sent = MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof *msg; msglen = (sizeof *msg) + sent; msg = xrealloc(msg, msglen); -- cgit