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:
Thomas Göttgens authored and GitHub committed 2026-07-29 22:29:12 +00:00
1 parent df6e67f70b
commit daf1213580
4 files changed
+23 -6

No files matched your search

+6 -1
View File
@@ -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;