Merge pull request #877 from BeigeBox/fix/writeserial-overflow

Add bounds check in writeSerial to prevent buffer overflow
This commit is contained in:
Jonathan Naylor 2026-04-06 19:53:54 +01:00 committed by GitHub
commit 58d06b4e6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);