diff --git a/emhttp/plugins/dynamix.vm.manager/include/VMajax.php b/emhttp/plugins/dynamix.vm.manager/include/VMajax.php index 0d7ebef62..c47440391 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/VMajax.php +++ b/emhttp/plugins/dynamix.vm.manager/include/VMajax.php @@ -325,7 +325,7 @@ case 'change-media': requireLibvirt(); $dev= $_REQUEST['dev']; $file= $_REQUEST['file']; - $cmdstr = "virsh change-media '$domName' $dev $file"; + $cmdstr = "virsh change-media ".escapeshellarg($domName)." ".escapeshellarg($dev)." ".escapeshellarg($file); #PHPS -changed $rtn=shell_exec($cmdstr) ? ['success' => true] : ['error' => "Change Media Failed"]; @@ -342,10 +342,10 @@ case 'change-media-both': } $file= $_REQUEST['file']; if ($file != "" && $hda == false) { - $cmdstr = "virsh attach-disk '$domName' '$file' hda --type cdrom --targetbus sata --config" ; + $cmdstr = "virsh attach-disk ".escapeshellarg($domName)." ".escapeshellarg($file)." hda --type cdrom --targetbus sata --config" ; #PHPS - Changed } else { - if ($file == "") $cmdstr = "virsh change-media '$domName' hda --eject --current"; - else $cmdstr = "virsh change-media '$domName' hda '$file'"; + if ($file == "") $cmdstr = "virsh change-media ".escapeshellarg($domName)." hda --eject --current"; #PHPS - Changed + else $cmdstr = "virsh change-media ".escapeshellarg($domName)." hda ".escapeshellarg($file); #PHPS - Changed } $rtn=shell_exec($cmdstr) ? ['success' => true] @@ -355,10 +355,10 @@ case 'change-media-both': $file2 = $_REQUEST['file2']; if ($file2 != "" && $hdb == false) { - $cmdstr = "virsh attach-disk '$domName' '$file2' hdb --type cdrom --targetbus sata --config" ; + $cmdstr = "virsh attach-disk ".escapeshellarg($domName)." ".escapeshellarg($file2)." hdb --type cdrom --targetbus sata --config" ; #PHPS - Changed } else { - if ($file2 == "") $cmdstr = "virsh change-media '$domName' hdb --eject --current"; - else $cmdstr = "virsh change-media '$domName' hdb '$file2' "; + if ($file2 == "") $cmdstr = "virsh change-media ".escapeshellarg($domName)." hdb --eject --current";#PHPS - Changed + else $cmdstr = "virsh change-media ".escapeshellarg($domName)." hdb '".escapeshellarg($file2)."' "; #PHPS - Changed } $rtn=shell_exec($cmdstr) ? ['success' => true] @@ -502,7 +502,7 @@ case 'vm-removal': $dirname = str_replace('/mnt/user/', "/mnt/$realdisk/", $dirname); } } - $fstype = trim(shell_exec(" stat -f -c '%T' $dirname")); + $fstype = trim(shell_exec(" stat -f -c '%T' ".escapeshellarg($dirname))); #PHPS - Changed $html = '
| '._('VM Being removed').': | '.$domName.' |
| '._('Remove all files').': |