Repeater, room server, sensor: fix CLI reply buffer overflow, OTA bounds checks, and ACL slot rotation

This commit is contained in:
tth committed 2026-12-02 00:12:33 +01:00
1 parent e9501d0437
commit 5a83c230cd
5 files changed
+15 -11

No files matched your search

+3 -2
View File
@@ -220,7 +220,7 @@ void MyMesh::formatNodesReply(char* reply, int max_len, uint16_t offset) {
(int)n->snr, (int)n->rssi, (unsigned long)(now - n->heard_timestamp),
(unsigned long)n->pkt_hash, pathhex, n->name);
int ll = strlen(line);
if (i > offset && (dp - reply) + ll + 24 > max_len) break; // room for trailer; always emit >=1
if ((dp - reply) + ll + 24 > max_len) break; // room for trailer; never overflow reply
memcpy(dp, line, ll); dp += ll;
}
dp += sprintf(dp, "E,%d,%d", i, total);
@@ -277,7 +277,7 @@ void MyMesh::formatRxLogReply(char* reply, int max_len, uint32_t cursor) {
(unsigned long)r->pkt_hash, (unsigned)r->header,
(int)r->snr, (int)r->rssi, pathhex);
int ll = strlen(line);
if (i > 0 && (dp - reply) + ll + 40 > max_len) break; // room for trailer; always emit >=1
if ((dp - reply) + ll + 40 > max_len) break; // room for trailer; never overflow reply
memcpy(dp, line, ll); dp += ll;
last = r->seq;
}
@@ -1934,6 +1934,7 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, char *command, char *reply
if (strlen(command) > 4 && command[2] == '|') { // optional prefix (for companion radio CLI)
memcpy(reply, command, 3); // reflect the prefix back
reply += 3;
reply_max = reply_max > 3 ? reply_max - 3 : 0;
command += 3;
}