From: Fabian Grünbichler <f.gruenbich...@proxmox.com> creating non-raw disk images with arbitrary content is only possible with raw access to the storage, but checking for references to external files doesn't hurt, in case for non pve-managed volumes.
Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com> [ DC: removed prolematic checks for pve-managed volumes ] Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> --- PVE/API2/Qemu.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 1c3cb271..b9c63af8 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -413,12 +413,15 @@ my sub create_disks : prototype($$$$$$$$$$) { $needs_creation = $live_import; - if (PVE::Storage::parse_volume_id($source, 1)) { # PVE-managed volume + my ($source_storage, $source_volid) = PVE::Storage::parse_volume_id($source, 1); + + if ($source_storage) { # PVE-managed volume if ($live_import && $ds ne 'efidisk0') { my $path = PVE::Storage::path($storecfg, $source) or die "failed to get a path for '$source'\n"; $source = $path; ($size, my $source_format) = PVE::Storage::file_size_info($source); + die "could not get file size of $source\n" if !$size; $live_import_mapping->{$ds} = { path => $source, @@ -442,7 +445,8 @@ my sub create_disks : prototype($$$$$$$$$$) { } } else { $source = PVE::Storage::abs_filesystem_path($storecfg, $source, 1); - ($size, my $source_format) = PVE::Storage::file_size_info($source); + # check potentially untrusted image file! + ($size, my $source_format) = PVE::Storage::file_size_info($source, undef, 1); die "could not get file size of $source\n" if !$size; if ($live_import && $ds ne 'efidisk0') { -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel