Browse Source

Fix macros that call macros crashing (#21383)

When macros call macros, the null termination should remain in place until the macro is completed, and only then put back. Otherwise, the macro handler interprets this as setting the macro called to a new value.
vanilla_fb_2.0.x
mihtjel 4 years ago
committed by GitHub
parent
commit
50a6ffa952
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Marlin/src/gcode/gcode.cpp

2
Marlin/src/gcode/gcode.cpp

@ -1048,8 +1048,8 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
char * const delim = strchr(gcode, '\n'); // Get address of next newline
if (delim) *delim = '\0'; // Replace with nul
parser.parse(gcode); // Parse the current command
if (delim) *delim = '\n'; // Put back the newline
process_parsed_command(true); // Process it
if (delim) *delim = '\n'; // Put back the newline
if (!delim) break; // Last command?
gcode = delim + 1; // Get the next command
}

Loading…
Cancel
Save