]> git.proxmox.com Git - pve-storage.git/commit
plugins: untaint volume_size_info retuns
authorStoiko Ivanov <s.ivanov@proxmox.com>
Tue, 22 Jun 2021 16:39:54 +0000 (18:39 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 23 Jun 2021 06:28:48 +0000 (08:28 +0200)
commitac598d851ed4712307a780b4db1f4da488a3b6c6
tree6e25f1c2eb6f4fb262d26f0d5aa01a19f0440220
parentffc31266da8854be3e9063d5f44dcbd1decbe4f9
plugins: untaint volume_size_info retuns

the size returned by volume_size_info is used for creating the new
destination image in PVE::QemuServer::clone_disk (and probably
elsewhere). In certain cases the return values are tainted - they are
obtained by a run_command call and depending on the format and length
of the parsed output can still have their tainted attribute.

One example of a tainted return has been reported in our
community-forum:
https://forum.proxmox.com/threads/cannot-clone-vm-or-move-disk-with-more-than-13-snapshots.89628/

A qcow2 image with 13 snapshots generates a output > 4k in length from
`qemu-img info --output=json`, which in turn causes the output to be
considered tainted.

This patch untaints the returns where applicable. The other
storage-plugins are not affected:
* LVMPlugin returns a single number and a newline (thus gets untainted
  by run_command)
* RBDPlugin untaints the complete json before decoding
* ZFSPoolplugin and ISCSIDirectPlugin explicitly untaint their
  returns.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
PVE/Storage/PBSPlugin.pm
PVE/Storage/Plugin.pm