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);