fix: buffer overflow, OOB read, packet leaks, BLE sign leak, USB timeout, atomics, fs_read checks

- RegionMap::findMatch(): fix 1-byte stack overflow in tmp[] with bounded memcpy
- Packet::readFrom(): add bounds checks before reading transport codes
- Mesh::sendFlood(): release packet on TRACE type and invalid hash_size early returns
- CompanionMesh: add cleanupSignState() called from BLE disconnect to free sign buffer
- ZephyrCompanionUSB: add 2s timeout for partial V3 frames to prevent parser stall
- ui_mesh_actions: replace volatile bool with Zephyr atomic_t for cross-thread state
- CommonCLI: wrap ~40 fs_read() calls in prefs_read() helper with truncation warning
This commit is contained in:
liquidraver
2026-03-04 22:12:13 +01:00
parent a4e96fa6e6
commit d949ca4f6e
9 changed files with 764 additions and 61 deletions
+2
View File
@@ -81,8 +81,10 @@ uint8_t Packet::writeTo(uint8_t dest[]) const
bool Packet::readFrom(const uint8_t src[], uint8_t len)
{
uint8_t i = 0;
if (len < 2) return false;
header = src[i++];
if (hasTransportCodes()) {
if (len < 6) return false;
memcpy(&transport_codes[0], &src[i], 2); i += 2;
memcpy(&transport_codes[1], &src[i], 2); i += 2;
} else {