From 2ce56123e75493f8850cc83ac8045743e77642ba Mon Sep 17 00:00:00 2001 From: Ember Date: Sun, 5 Apr 2026 17:59:42 -0700 Subject: [PATCH] Add bounds check in writeSerial to prevent buffer overflow --- MMDVMHost.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index cba4634..4dba290 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -3108,6 +3108,9 @@ void CMMDVMHost::writeSerial(const unsigned char* message, unsigned int length) assert(m_modem != nullptr); assert(message != nullptr); + if (length > 5000U) + return; + if (length <= 252U) { // Simple case of a short message, send it immediately to the modem m_modem->writeSerialData(message, length);