From 11942dc6d7a8c44d4cb788b0e6ab26948e60e098 Mon Sep 17 00:00:00 2001 From: Folkert van Heusden Date: Mon, 4 Nov 2024 09:56:25 +0100 Subject: [PATCH] when server pushes too much data, purge that data --- server.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server.cpp b/server.cpp index 619433c..48544c5 100644 --- a/server.cpp +++ b/server.cpp @@ -197,6 +197,15 @@ std::tuple server::receive_pdu(com DOLOG(logging::ll_debug, "server::receive_pdu", cc->get_endpoint_name(), "initiator is pushing too much data (%zu bytes, max is %u)", data_length, MAX_DATA_SEGMENT_SIZE); ok = false; pdu_error = IFR_INVALID_FIELD; + + uint8_t temp[32]; + size_t temp_len = data_length; + while(temp_len) { + if (cc->recv(temp, std::min(temp_len, sizeof temp)) == false) { + pdu_error = IFR_CONNECTION; + break; + } + } } else if (data_length) { size_t padded_data_length = (data_length + 3) & ~3;