diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 0732a1cfa6b0b669238f18c483bebbde9cfe74e6..0d4ddc9ecd35acf0606e08177de555591307c02f 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -5293,7 +5293,7 @@ void process_next_command() {
     while (*current_command == ' ') ++current_command; // skip [ ]*
   }
   char *starpos = strchr(current_command, '*');  // * should always be the last parameter
-  if (starpos) *starpos = '\0';
+  if (starpos) while (*starpos == ' ' || *starpos == '*') *starpos-- = '\0'; // nullify '*' and ' '
 
   // Get the command code, which must be G, M, or T
   char command_code = *current_command;