1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 03:08:14 +00:00

Protect variable replacement for Qemu options. Escape double quotes.

This commit is contained in:
grossmj 2017-12-21 09:38:18 +01:00
parent 79bca29b93
commit 23c63bbd4d

View File

@ -1645,10 +1645,10 @@ class QemuVM(BaseNode):
"""
additional_options = self._options.strip()
additional_options = additional_options.replace("%vm-name%", '"' + self._name + '"')
additional_options = additional_options.replace("%vm-name%", '"' + self._name.replace('"', '\\"') + '"')
additional_options = additional_options.replace("%vm-id%", self._id)
additional_options = additional_options.replace("%project-id%", self.project.id)
additional_options = additional_options.replace("%project-path%", '"' + self.project.path + '"')
additional_options = additional_options.replace("%project-path%", '"' + self.project.path.replace('"', '\\"') + '"')
command = [self.qemu_path]
command.extend(["-name", self._name])
command.extend(["-m", "{}M".format(self._ram)])