Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/simple_repeater/MyMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,8 @@ void MyMesh::onPeerDataRecv(mesh::Packet *packet, uint8_t type, int sender_idx,
}
}

uint8_t temp[166];
// 5-byte datagram header + 3-byte reflected CLI prefix + 160-byte reply text + NUL
uint8_t temp[169];
char *command = (char *)&data[5];
char *reply = (char *)&temp[5];
if (is_retry) {
Expand Down
3 changes: 2 additions & 1 deletion examples/simple_room_server/MyMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ void MyMesh::onPeerDataRecv(mesh::Packet *packet, uint8_t type, int sender_idx,
mesh::Utils::sha256((uint8_t *)&ack_hash, 4, data, 5 + strlen((char *)&data[5]), client->id.pub_key,
PUB_KEY_SIZE);

uint8_t temp[166];
// 5-byte datagram header + 3-byte reflected CLI prefix + 160-byte reply text + NUL
uint8_t temp[169];
bool send_ack;
if (flags == TXT_TYPE_CLI_DATA || flags == TXT_TYPE_CLI_COMMAND) {
if (client->isAdmin()) {
Expand Down
3 changes: 2 additions & 1 deletion examples/simple_sensor/SensorMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,8 @@ void SensorMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_i
// len can be > original length, but 'text' will be padded with zeroes
data[len] = 0; // need to make a C string again, with null terminator

uint8_t temp[166];
// 5-byte datagram header + 3-byte reflected CLI prefix + 160-byte reply text + NUL
uint8_t temp[169];
char *command = (char *) &data[5];
char *reply = (char *) &temp[5];
handleCommand(from, sender_timestamp, command, reply);
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/BaseChatMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ void BaseChatMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender
onCommandDataRecv(from, packet, sender_timestamp, text); // let UI know
// NOTE: no ack expected for CLI_DATA replies
} else if (flags == TXT_TYPE_CLI_COMMAND) {
uint8_t temp[166];
// 5-byte datagram header + 3-byte reflected CLI prefix + 160-byte reply text + NUL
uint8_t temp[169];
char *command = (char *)&data[5];
char *reply = (char *)&temp[5];
*reply = 0;
Expand Down