From 82374540f765f47cc5927b0fe8235493af6f8503 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Fri, 31 Aug 2012 01:05:51 +0200 Subject: [PATCH] ctl: increase maximum message size to 512 KB This can now be done safely since we don't rely on message boundaries anymore. --- src/ctl.c | 2 +- src/ctl.h | 1 + src/daemon/event.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ctl.c b/src/ctl.c index 6108741f..9799efac 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -198,7 +198,7 @@ ctl_msg_recv_unserialized(uint8_t **input_buffer, size_t *input_len, return sizeof(struct hmsg_header) - *input_len; } hdr = (struct hmsg_header *)*input_buffer; - if (hdr->len > (1<<15)) { + if (hdr->len > HMSG_MAX_SIZE) { LLOG_WARNX("message received is too large"); /* We discard the whole buffer */ free(*input_buffer); diff --git a/src/ctl.h b/src/ctl.h index 1cd66c82..01e88b30 100644 --- a/src/ctl.h +++ b/src/ctl.h @@ -42,6 +42,7 @@ struct hmsg_header { enum hmsg_type type; size_t len; }; +#define HMSG_MAX_SIZE (1<<19) /* ctl.c */ int ctl_create(char *); diff --git a/src/daemon/event.c b/src/daemon/event.c index 18464f6b..2eef6478 100644 --- a/src/daemon/event.c +++ b/src/daemon/event.c @@ -295,7 +295,7 @@ levent_ctl_recv(struct bufferevent *bev, void *ptr) LLOG_WARNX("not able to read header"); return; } - if (hdr.len > (1<<15)) { + if (hdr.len > HMSG_MAX_SIZE) { LLOG_WARNX("message received is too large"); goto recv_error; } -- 2.39.5