From 3d65f73f978430a68fe3d79a9c688c81ace66f63 Mon Sep 17 00:00:00 2001 From: "Morgan 'ARR\\!' Allen" Date: Fri, 24 Apr 2020 22:58:59 -0700 Subject: [PATCH] try to restrain long string dumps --- main/lorcomm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/lorcomm.c b/main/lorcomm.c index 1b4a378..ec7de2a 100644 --- a/main/lorcomm.c +++ b/main/lorcomm.c @@ -65,6 +65,11 @@ void lorcomm_handle_receive(uint8_t size) { memcpy(msg->msg, buf + LORA_PACKET_HEADER_SIZE + LORA_MSG_HEADER_SIZE, msg->length); + // if the msg doesnt end in NULL it's probably already corrupt + // just go ahead and terminate it + if(msg->msg[msg->length] != '\0') + msg->msg[msg->length] == '\0'; + ESP_LOGI(TAG, "msg (len: %d): %s", msg->length, msg->msg); free(msg->msg);