summaryrefslogtreecommitdiffstats
path: root/client.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 /client.c
parenteaa58d28dc7da9b2ef0d77f4c8e85aab55b71935 (diff)
Need to include message size in the maximum buffer calculation.
Diffstat (limited to 'client.c')
-rw-r--r--client.c4
1 files changed, 2 insertions, 2 deletions
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;