mirror of
https://github.com/g4klx/MMDVMHost.git
synced 2026-04-21 06:13:49 +00:00
Merge pull request #877 from BeigeBox/fix/writeserial-overflow
Add bounds check in writeSerial to prevent buffer overflow
This commit is contained in:
commit
58d06b4e6a
1 changed files with 3 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue