mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2025-01-05 09:17:59 +03:00
file/volume size info: add actual errors to untaint messages
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
ac598d851e
commit
d4e00f2bd5
@ -811,7 +811,7 @@ sub volume_size_info {
|
||||
|
||||
my $size = 0;
|
||||
foreach my $info (@$data) {
|
||||
if ($info->{size} && $info->{size} =~ /^(\d+)$/) {
|
||||
if ($info->{size} && $info->{size} =~ /^(\d+)$/) { # untaints
|
||||
$size += $1;
|
||||
}
|
||||
}
|
||||
|
@ -837,11 +837,11 @@ sub file_size_info {
|
||||
|
||||
my ($size, $format, $used, $parent) = $info->@{qw(virtual-size format actual-size backing-filename)};
|
||||
|
||||
($size) = ($size =~ /^(\d+)$/); #untaint
|
||||
($used) = ($used =~ /^(\d+)$/); #untaint
|
||||
($format) = ($format =~ /^([-\w]+)$/); #untaint
|
||||
($size) = ($size =~ /^(\d+)$/) or die "size '$size' not an integer\n"; # untaint
|
||||
($used) = ($used =~ /^(\d+)$/) or die "used '$used' not an integer\n"; # untaint
|
||||
($format) = ($format =~ /^(\S+)$/) or die "format '$format' includes whitespace\n"; # untaint
|
||||
if (defined($parent)) {
|
||||
($parent) = ($parent =~ /^(.*)$/); #untaint
|
||||
($parent) = ($parent =~ /^(\S+)$/) or die "parent '$parent' includes whitespace\n"; # untaint
|
||||
}
|
||||
return wantarray ? ($size, $format, $used, $parent, $st->ctime) : $size;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user