From 9f084f48f63d8e2effa38b82de9d09460c58c05d Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 1 May 2026 12:31:49 +0300 Subject: [PATCH] Add request size validation to prevent OOMDoS --- src/client/msgr_receive.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client/msgr_receive.cpp b/src/client/msgr_receive.cpp index 295727df..780fe3d0 100644 --- a/src/client/msgr_receive.cpp +++ b/src/client/msgr_receive.cpp @@ -732,7 +732,13 @@ bool osd_messenger_t::allocate_op_buffers(osd_client_t *cl) { osd_op_t *cur_op = cl->read_op; cl->read_op_size = 0; - if (cur_op->req.hdr.opcode == OSD_OP_SEC_WRITE || + if (!osd_num) + { + if (log_level > 1) + fprintf(stderr, "Error: operation received from an OSD peer %ju, stopping\n", cl->client_id); + return false; + } + else if (cur_op->req.hdr.opcode == OSD_OP_SEC_WRITE || cur_op->req.hdr.opcode == OSD_OP_SEC_WRITE_STABLE) { if (cur_op->req.sec_rw.attr_len > 0)