]> git.proxmox.com Git - pve-common.git/commitdiff
print_text_table: untaint $width
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 27 Jul 2018 12:55:17 +0000 (14:55 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 30 Jul 2018 13:51:23 +0000 (15:51 +0200)
The value of $width depends on possible untainted $data (for example
task logs read from external files).

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
src/PVE/CLIFormatter.pm

index f6ad45921842c827504ddcd7d738d6d472a54f4d..119bc063cdc0785044e745767f9274137840bd43 100644 (file)
@@ -209,6 +209,8 @@ sub print_text_table {
                $width = $len if $len > $width;
            }
 
+           $width = ($width =~ m/^(\d+)$/) ? int($1) : 0; # untaint int
+
            $rowdata->{$prop} = {
                lines => $lines,
                width => $width,