[pve-devel] [PATCH storage v5 12/12] plugin: file_size_info: don't ignore base path with whitespace

Dominik Csapak d.csapak at proxmox.com
Thu Nov 14 10:32:13 CET 2024


if the base image (parent) of an image contains whitespace in it's path
(e.g. a space), the current untainting would not match and it would seem
there was no parent.

Fix that by adapting the untaint regex

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PVE/Storage/Plugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index e95b720..e8fed56 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -1031,7 +1031,7 @@ sub file_size_info {
     ($format) = ($format =~ /^(\S+)$/); # untaint
     die "format '$format' includes whitespace\n" if !defined($format);
     if (defined($parent)) {
-	($parent) = ($parent =~ /^(\S+)$/); # untaint
+	($parent) = ($parent =~ /^(.*)$/); # untaint
     }
     return wantarray ? ($size, $format, $used, $parent, $st->ctime) : $size;
 }
-- 
2.39.5





More information about the pve-devel mailing list