mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2025-01-07 17:18:02 +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;
|
my $size = 0;
|
||||||
foreach my $info (@$data) {
|
foreach my $info (@$data) {
|
||||||
if ($info->{size} && $info->{size} =~ /^(\d+)$/) {
|
if ($info->{size} && $info->{size} =~ /^(\d+)$/) { # untaints
|
||||||
$size += $1;
|
$size += $1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -837,11 +837,11 @@ sub file_size_info {
|
|||||||
|
|
||||||
my ($size, $format, $used, $parent) = $info->@{qw(virtual-size format actual-size backing-filename)};
|
my ($size, $format, $used, $parent) = $info->@{qw(virtual-size format actual-size backing-filename)};
|
||||||
|
|
||||||
($size) = ($size =~ /^(\d+)$/); #untaint
|
($size) = ($size =~ /^(\d+)$/) or die "size '$size' not an integer\n"; # untaint
|
||||||
($used) = ($used =~ /^(\d+)$/); #untaint
|
($used) = ($used =~ /^(\d+)$/) or die "used '$used' not an integer\n"; # untaint
|
||||||
($format) = ($format =~ /^([-\w]+)$/); #untaint
|
($format) = ($format =~ /^(\S+)$/) or die "format '$format' includes whitespace\n"; # untaint
|
||||||
if (defined($parent)) {
|
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;
|
return wantarray ? ($size, $format, $used, $parent, $st->ctime) : $size;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user