summaryrefslogtreecommitdiff
path: root/lib/mgmt_msg.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mgmt_msg.c')
-rw-r--r--lib/mgmt_msg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/mgmt_msg.c b/lib/mgmt_msg.c
index b03dbe8cc3..23cfbc3b01 100644
--- a/lib/mgmt_msg.c
+++ b/lib/mgmt_msg.c
@@ -111,6 +111,11 @@ enum mgmt_msg_rsched mgmt_msg_read(struct mgmt_msg_state *ms, int fd,
* therefor the stream is too small to fit the message..
* Resize the stream to fit.
*/
+ if (mhdr->len > MGMT_MSG_MAX_MSG_ALLOC_LEN) {
+ MGMT_MSG_ERR(ms, "corrupt msg len rcvd %u",
+ mhdr->len);
+ return MSR_DISCONNECT;
+ }
news = stream_new(mhdr->len);
stream_put(news, mhdr, left);
stream_set_endp(news, left);