From 40b33820238f45e72b03b1b60274f0403af5f817 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Fri, 17 Sep 2021 10:56:58 +0100 Subject: [PATCH] Enable WS data size check --- mongoose.c | 2 +- src/ws.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 78d27c2a..5c552cb5 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4533,7 +4533,7 @@ static size_t ws_process(uint8_t *buf, size_t len, struct ws_msg *msg) { } // Sanity check, and integer overflow protection for the boundary check below // data_len should not be larger than 1 Gb - // if (msg->data_len > 1024 * 1024 * 1024) return 0; + if (msg->data_len > 1024 * 1024 * 1024) return 0; if (msg->header_len + msg->data_len > len) return 0; if (mask_len > 0) { uint8_t *p = buf + msg->header_len, *m = p - mask_len; diff --git a/src/ws.c b/src/ws.c index 28cb7074..fc30c302 100644 --- a/src/ws.c +++ b/src/ws.c @@ -66,7 +66,7 @@ static size_t ws_process(uint8_t *buf, size_t len, struct ws_msg *msg) { } // Sanity check, and integer overflow protection for the boundary check below // data_len should not be larger than 1 Gb - // if (msg->data_len > 1024 * 1024 * 1024) return 0; + if (msg->data_len > 1024 * 1024 * 1024) return 0; if (msg->header_len + msg->data_len > len) return 0; if (mask_len > 0) { uint8_t *p = buf + msg->header_len, *m = p - mask_len;