ACK

On 14/01/15 17:04, Jan Friesse wrote:
Corosync limit to send/receive message is 1 megabyte. Patch ensures this
limit is never overrun.

Signed-off-by: Jan Friesse <[email protected]>
---
  exec/main.c |   15 +++++++++++++++
  1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/exec/main.c b/exec/main.c
index cd972b5..3068ac9 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -714,10 +714,25 @@ int main_mcast (
        const struct qb_ipc_request_header *req = iovec->iov_base;
        int32_t service;
        int32_t fn_id;
+       size_t msg_len;
+       unsigned int i;

        service = req->id >> 16;
        fn_id = req->id & 0xffff;

+       msg_len = 0;
+
+       for (msg_len = 0, i = 0; i < iov_len; msg_len += iovec[i].iov_len, i++)
+           ;
+
+       if (msg_len > MESSAGE_SIZE_MAX) {
+               log_printf(LOGSYS_LEVEL_ERROR,
+                       "IPC client is trying to send message larger (%zu bytes) 
then allowed maximum %u bytes",
+                       msg_len, MESSAGE_SIZE_MAX);
+
+               return (-1);
+       }
+
        if (corosync_service[service]) {
                icmap_fast_inc(service_stats_tx[service][fn_id]);
        }


_______________________________________________
discuss mailing list
[email protected]
http://lists.corosync.org/mailman/listinfo/discuss

Reply via email to