mirror of
https://github.com/meshtastic/firmware.git
synced 2026-09-20 05:18:54 -04:00
Licensed channel defaults, phone map growth, and payload read bounds (#11286)
* Strip the default PSK when licensed defaults are installed * Only record rate-limited portnums from the phone * Bound payload reads by the received size
This commit is contained in:
1 parent
df6e67f70b
commit
daf1213580
4 files changed
+23
-6
No files matched your search
@@ -215,7 +215,12 @@ const StoredMessage *MessageStore::tryAddFromPacket(const meshtastic_MeshPacket
|
||||
sm.channelIndex = packet.channel;
|
||||
|
||||
const char *payload = reinterpret_cast<const char *>(packet.decoded.payload.bytes);
|
||||
size_t len = strnlen(payload, MAX_MESSAGE_SIZE - 1);
|
||||
// payload.bytes is not NUL-terminated, so bound by the received size too: a shorter message
|
||||
// stored after a longer one would otherwise pick up the previous occupant's trailing bytes.
|
||||
size_t avail = packet.decoded.payload.size;
|
||||
if (avail > MAX_MESSAGE_SIZE - 1)
|
||||
avail = MAX_MESSAGE_SIZE - 1;
|
||||
size_t len = strnlen(payload, avail);
|
||||
sm.textOffset = storeTextInPool(payload, len);
|
||||
sm.textLength = len;
|
||||
|
||||
|
||||
Reference in new issue
Block a user