summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authornicm <nicm>2019-12-16 16:09:28 +0000
committernicm <nicm>2019-12-16 16:09:28 +0000
commitb4520aaf2cb56cd14519e2df9d99ea6efc8ddd03 (patch)
treeb26ffeb68057bca2966ae38fa3ba883d49341b73 /file.c
parenteaa58d28dc7da9b2ef0d77f4c8e85aab55b71935 (diff)
Need to include message size in the maximum buffer calculation.
Diffstat (limited to 'file.c')
-rw-r--r--file.c4
1 files changed, 2 insertions, 2 deletions
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);