Fix SerialPort crash on large MMDVM frame(>255)

This commit is contained in:
Shawn Chain 2021-12-20 13:34:33 +08:00
parent cf9fa93cb9
commit c06f1ff1a4
1 changed files with 3 additions and 3 deletions

View File

@ -1806,7 +1806,7 @@ void CSerialPort::writeFMData(const uint8_t* data, uint16_t length)
reply[2U] = (length + 4U) - 255U; reply[2U] = (length + 4U) - 255U;
reply[3U] = MMDVM_FM_DATA; reply[3U] = MMDVM_FM_DATA;
for (uint8_t i = 0U; i < length; i++) for (int i = 0U; i < length; i++)
reply[i + 4U] = data[i]; reply[i + 4U] = data[i];
writeInt(1U, reply, length + 4U); writeInt(1U, reply, length + 4U);
@ -1875,7 +1875,7 @@ void CSerialPort::writeAX25Data(const uint8_t* data, uint16_t length)
reply[2U] = (length + 4U) - 255U; reply[2U] = (length + 4U) - 255U;
reply[3U] = MMDVM_AX25_DATA; reply[3U] = MMDVM_AX25_DATA;
for (uint8_t i = 0U; i < length; i++) for (int i = 0U; i < length; i++)
reply[i + 4U] = data[i]; reply[i + 4U] = data[i];
writeInt(1U, reply, length + 4U); writeInt(1U, reply, length + 4U);
@ -2110,7 +2110,7 @@ void CSerialPort::writeDebugDump(const uint8_t* data, uint16_t length)
reply[2U] = (length + 4U) - 255U; reply[2U] = (length + 4U) - 255U;
reply[3U] = MMDVM_DEBUG_DUMP; reply[3U] = MMDVM_DEBUG_DUMP;
for (uint8_t i = 0U; i < length; i++) for (int i = 0U; i < length; i++)
reply[i + 4U] = data[i]; reply[i + 4U] = data[i];
writeInt(1U, reply, length + 4U); writeInt(1U, reply, length + 4U);