From a5704e70ed6399ca7208c9e0f351c5a5fd571aea Mon Sep 17 00:00:00 2001 From: Jesco Freund Date: Wed, 15 Dec 2021 05:11:43 +0100 Subject: [PATCH] GETD check remaining buffer size before adding data --- xpcPlugin/MessageHandlers.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xpcPlugin/MessageHandlers.cpp b/xpcPlugin/MessageHandlers.cpp index 5b1d79de..ae8aa156 100644 --- a/xpcPlugin/MessageHandlers.cpp +++ b/xpcPlugin/MessageHandlers.cpp @@ -540,6 +540,12 @@ namespace XPC { float values[255]; int count = DataManager::Get(connection.getdRequest[i], values, 255); + if ((cur + count * sizeof(float) + 1) > 4095) + { + Log::FormatLine(LOG_ERROR, "GETD", "ERROR: Too many data requested for connection %i.", + connection.id); + return; + } response[cur++] = count; memcpy(response + cur, values, count * sizeof(float)); cur += count * sizeof(float);