Bug fixes

This commit is contained in:
Derek Jamison
2023-01-27 22:10:53 -05:00
parent 6bcde7fd08
commit b3a68e3743
2 changed files with 17 additions and 11 deletions

View File

@@ -116,7 +116,10 @@ static void subghz_demo_receive_data(DemoContext* instance) {
// respond differently based on the version of the application running on the other Flipper Zero.
// Important: Don't always trust what is sent, some people with Flipper Zero might send an
// invalid version to trick your code into interpreting the payload in a special way.
// Null terminate the buffer at the end of message so we don't accidently overrun our buffer.
message[MESSAGE_MAX_LEN - 1] = 0;
unsigned int number;
char senderName[9];
switch (purpose) {
@@ -291,7 +294,7 @@ static void subghz_demo_broadcast(DemoContext* demo_context, FuriString* buffer)
if (length>MESSAGE_MAX_LEN) {
message[MESSAGE_MAX_LEN-1] = 0;
message[MESSAGE_MAX_LEN-2] = '\n';
message[MESSAGE_MAX_LEN-2] = '\r';
message[MESSAGE_MAX_LEN-3] = '\r';
length = MESSAGE_MAX_LEN;
}