]> git.proxmox.com Git - pve-cluster.git/commitdiff
fix tainted input in backup_cfs_database
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 12 Mar 2018 08:26:27 +0000 (09:26 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 13 Mar 2018 11:34:43 +0000 (12:34 +0100)
We can call this module also now over the API through
pvedaemon/pveproxy which have tainting checks on.

Thus we need to untaint the "read existing backups" inputs,
as else this errors out here.

Only triggers when over 10 backups existed already, so this does
not triggers really often in the real world.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
data/PVE/Cluster.pm

index 27b1c97206223fbe14a2f7da6a91ffe869bdf3c9..fabf5bcf16978f84022a5f46f6dec1aacdde753f 100644 (file)
@@ -1762,6 +1762,7 @@ my $backup_cfs_database = sub {
 
     if ((my $count = scalar(@$backups)) > $maxfiles) {
        foreach my $f (@$backups[$maxfiles..$count-1]) {
+           next if $f !~ m/^(\S+)$/; # untaint
            print "delete old backup '$1'\n";
            unlink $1;
        }