From 9f3f0baa47704d24c78945bae0e2c27e5b6ce263 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 13 Dec 2022 12:41:43 +0100 Subject: [PATCH] mmu: Use strncpy when possible Since tmp is always null-terminated we can save some time compared to a memcpy call. --- Firmware/mmu2_protocol_logic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/mmu2_protocol_logic.cpp b/Firmware/mmu2_protocol_logic.cpp index 160ca1d6a..6fe760572 100644 --- a/Firmware/mmu2_protocol_logic.cpp +++ b/Firmware/mmu2_protocol_logic.cpp @@ -715,7 +715,7 @@ void ProtocolLogic::LogRequestMsg(const uint8_t *txbuff, uint8_t size) { } else { MMU2_ECHO_MSGLN(tmp); } - memcpy(lastMsg, tmp, rqs); + strncpy(lastMsg, tmp, rqs); } void ProtocolLogic::LogError(const char *reason_P) {