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

Dominik Csapak d.csapak at proxmox.com
Fri May 24 15:21:56 CEST 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 848e053..b317e14 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -992,7 +992,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.2





More information about the pve-devel mailing list