gcode_macro: Use deepcopy() on get_status() results

If a get_status() method returns a mutable object (such as a list or
dict) then it would be possible for a gcode command template to
incorrectly alter the program's internal state.  Perform a deepcopy()
operation on all get_status() return results to avoid that.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-01-14 22:13:50 -05:00
parent 5b9beb52f6
commit 023a985bfc
4 changed files with 8 additions and 9 deletions

View file

@ -57,7 +57,7 @@ class SaveVariables:
gcmd.respond_info("Variable Saved")
self.loadVariables()
def get_status(self, eventtime):
return {'variables': dict(self.allVariables)}
return {'variables': self.allVariables}
def load_config(config):
return SaveVariables(config)