so we fail early for files disguising as a different format (e.g. vhdx).
One can't use such files anyway since we explicitly add the expected
format to disks, so this only gives an earlier and prettier error when
e.g. importing an OVA file with such a badly named disk image.

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
Reviewed-by: Fiona Ebner <f.eb...@proxmox.com>
---
 src/PVE/Storage/Plugin.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 0b0b5a8..6a7f468 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -1035,6 +1035,12 @@ sub file_size_info {
     $used = int($used);
     ($format) = ($format =~ /^(\S+)$/); # untaint
     die "format '$format' includes whitespace\n" if !defined($format);
+
+    if ($untrusted) {
+       die "format '$format' not supported\n"
+           if $format ne 'raw' && $format ne 'qcow2' && $format ne 'vmdk';
+    }
+
     if (defined($parent)) {
        warn "strange parent name path '$parent' found\n" if $parent =~ 
m/[^\S]/;
        ($parent) = ($parent =~ /^(\S+)$/); # untaint
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to