From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 142FB61895 for ; Mon, 17 Jan 2022 16:38:16 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 124081CDF1 for ; Mon, 17 Jan 2022 16:38:16 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 561091CDE6 for ; Mon, 17 Jan 2022 16:38:15 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E1F97460C0 for ; Mon, 17 Jan 2022 16:38:14 +0100 (CET) Date: Mon, 17 Jan 2022 16:38:07 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20220113100831.34113-1-f.ebner@proxmox.com> <20220113100831.34113-3-f.ebner@proxmox.com> In-Reply-To: <<20220113100831.34113-3-f.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1642417769.0u2oha0rg3.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.219 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH v10 qemu-server 2/7] parse ovf: untaint path when calling file_size_info X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jan 2022 15:38:16 -0000 On January 13, 2022 11:08 am, Fabian Ebner wrote: > Prepare for calling parse_ovf via API, where the -T switch is used. >=20 > Signed-off-by: Fabian Ebner > --- >=20 > New in v10. >=20 > PVE/QemuServer/OVF.pm | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) >=20 > diff --git a/PVE/QemuServer/OVF.pm b/PVE/QemuServer/OVF.pm > index 0376cbf..4a0d373 100644 > --- a/PVE/QemuServer/OVF.pm > +++ b/PVE/QemuServer/OVF.pm > @@ -221,10 +221,11 @@ ovf:Item[rasd:InstanceID=3D'%s']/rasd:ResourceType"= , $controller_id); > die "error parsing $filepath, file seems not to exist at $backing_f= ile_path\n"; > } > =20 > - my $virtual_size; > - if ( !($virtual_size =3D PVE::Storage::file_size_info($backing_file_pat= h)) ) { > - die "error parsing $backing_file_path, size seems to be $virtual_si= ze\n"; > - } > + my $virtual_size =3D PVE::Storage::file_size_info( > + ($backing_file_path =3D~ m|^(/.*)|)[0] # untaint > + ); > + die "error parsing $backing_file_path, cannot determine file size\n" > + if !$virtual_size; nit: I think I'd prefer untainting outside of the call to=20 file_size_info.. > =20 > $pve_disk =3D { > disk_address =3D> $pve_disk_address, > --=20 > 2.30.2 >=20 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 >=20