From 02a711c4d661da6814be050a6acb66174c9b3e96 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Tue, 24 Apr 2018 12:44:22 -0600 Subject: [PATCH] [2.0.x] Fix crash upon repeated calls to process_subcommands_now_P (#10509) --- Marlin/src/gcode/gcode.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index b9ded9863a..5c84db13de 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -701,8 +701,7 @@ void GcodeSuite::process_next_command() { */ void GcodeSuite::process_subcommands_now_P(const char *pgcode) { // Save the parser state - char saved_cmd[strlen(parser.command_ptr) + 1]; - strcpy(saved_cmd, parser.command_ptr); + const char * const saved_cmd = parser.command_ptr; // Process individual commands in string while (pgm_read_byte_near(pgcode)) {