]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
ctl: increase maximum message size to 512 KB
authorVincent Bernat <bernat@luffy.cx>
Thu, 30 Aug 2012 23:05:51 +0000 (01:05 +0200)
committerVincent Bernat <bernat@luffy.cx>
Thu, 30 Aug 2012 23:05:51 +0000 (01:05 +0200)
This can now be done safely since we don't rely on message boundaries
anymore.

src/ctl.c
src/ctl.h
src/daemon/event.c

index 6108741f08a3085b1222ddda9baf4e0f30b1afa0..9799efac85058efee94ce9480402e29d049e8fe3 100644 (file)
--- 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);
index 1cd66c82d30bd9c1334805de26b340357f3dc415..01e88b3064e58358bbec12dd7e3b56622c6a04ac 100644 (file)
--- 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 *);
index 18464f6b17e5c2c68abc51cf108baaa2771e900b..2eef6478d5307f41e37877d7a493d9003a61585c 100644 (file)
@@ -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;
        }