From c49e679bd91eaaecbd2b6c97bbeff6c904ca790f Mon Sep 17 00:00:00 2001 From: samuelsadok Date: Thu, 19 Sep 2019 10:10:51 +0200 Subject: [PATCH] fix bad use of memcpy memcpy is not guaranteed to work with overlapped memory areas, however memmove is. Apart from the semantic difference this fixes a compiler warning and possibly previously unexplained occurrences of `ERROR_INVALID_STATE`. --- Firmware/MotorControl/axis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/MotorControl/axis.cpp b/Firmware/MotorControl/axis.cpp index e5f25b16..8ed9a4a3 100644 --- a/Firmware/MotorControl/axis.cpp +++ b/Firmware/MotorControl/axis.cpp @@ -438,6 +438,6 @@ void Axis::run_state_machine_loop() { if (!status) current_state_ = AXIS_STATE_IDLE; else - memcpy(task_chain_, task_chain_ + 1, sizeof(task_chain_) - sizeof(task_chain_[0])); + memmove(task_chain_, task_chain_ + 1, sizeof(task_chain_) - sizeof(task_chain_[0])); } }