From nobody Tue Feb 10 20:48:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1680528264; cv=none; d=zohomail.com; s=zohoarc; b=jrJfQxs08akb+rkFjX5mMipQKJ0MBx+tqM8VT9h1SZuuC9q/hj+lNPuWLlSfLj/W6aowXgNGm8juiexblxDL7I4QL2batHWFN/lKAkybBDRQHnY92IFQCNe5+jJO08YU0/H7vjAuNjL0QLXSXdE6tpQ1SWOkLpzYiK9E5W4ssqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680528264; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=A4kuYo0AqAWLXoKY+i+1m17A9Q0BRITlDRSMmyLTrPA=; b=n5jmCIX3px4A/GwyTAU0WGpEHxRKNDFFyAasWz/o4HeHDVA3vVBWTNaZB7i+N74f8WbGBGnpCzJL78nAAf72bv0YoXG6PhW8XKocaDG9nUqBl4WROjy5riJFkTjUtUuKqUlwT+31rhK5GYj2yWjaZGZdpGwhOiZlMiDw3vvMQSo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 168052826424986.21017023778609; Mon, 3 Apr 2023 06:24:24 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-384-8M56e6QANoeSW92eaYYfQw-1; Mon, 03 Apr 2023 09:24:20 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 828B33C0F383; Mon, 3 Apr 2023 13:24:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6BB82166B26; Mon, 3 Apr 2023 13:24:14 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B417019465B1; Mon, 3 Apr 2023 13:24:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 13E2A19465A8 for ; Mon, 3 Apr 2023 13:24:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 06C6DC15BB8; Mon, 3 Apr 2023 13:24:13 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F3FD6C15BA0 for ; Mon, 3 Apr 2023 13:24:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97EC43C0F382 for ; Mon, 3 Apr 2023 13:24:12 +0000 (UTC) Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-482-Dkv8deTbOpOJEHxxyLkT1A-1; Mon, 03 Apr 2023 09:24:10 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 8AE981864F3C for ; Mon, 3 Apr 2023 16:24:07 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id WycDm3AZ5ZZj; Mon, 3 Apr 2023 16:24:07 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 3986618648A6; Mon, 3 Apr 2023 16:24:07 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 4Kkn0cskFrTW; Mon, 3 Apr 2023 16:24:07 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.15.101]) by mail.astralinux.ru (Postfix) with ESMTPSA id 08DD51864D51; Mon, 3 Apr 2023 16:24:06 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680528263; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=A4kuYo0AqAWLXoKY+i+1m17A9Q0BRITlDRSMmyLTrPA=; b=jVU/6Eb/D+u7/keZwumkhFGglhPl/Lis3/i35U2mIv3zkrKCFWuwWF5+kkrsUA70/FF6Xb EIH9KN2fgu6bqZ/BH81nNgjq6Hg86YqeucQu8XNEtTEtqT4qNBXRnrvru/Bvd4t4X0A0Au 7q7m6iewm1q49FMkkP2xDurlPO6RFuY= X-MC-Unique: 8M56e6QANoeSW92eaYYfQw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: Dkv8deTbOpOJEHxxyLkT1A-1 X-Virus-Scanned: amavisd-new at astralinux.ru From: Anastasia Belova To: libvir-list@redhat.com Subject: [PATCHv2] storage_file_probe: change maximum len value in vmdk4GetBackingStore Date: Mon, 3 Apr 2023 16:24:00 +0300 Message-Id: <20230403132400.3144-1-abelova@astralinux.ru> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anastasia Belova Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: astralinux.ru Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1680528265932100001 Content-Type: text/plain; charset="utf-8"; x-default="true" desc length should be always less than VIR_STORAGE_MAX_HEADER. If len =3D VIR_STORAGE_MAX_HEADER, desc may be out of bounds. Fixes: 348b4e254b ("storage: always probe type with buffer") Signed-off-by: Anastasia Belova --- v2: change Fixes: line src/storage_file/storage_file_probe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/stora= ge_file_probe.c index 9465af5d96..0dcc9c2c54 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -586,8 +586,8 @@ vmdk4GetBackingStore(char **res, return BACKING_STORE_INVALID; =20 len =3D buf_size - 0x200; - if (len > VIR_STORAGE_MAX_HEADER) - len =3D VIR_STORAGE_MAX_HEADER; + if (len >=3D VIR_STORAGE_MAX_HEADER) + len =3D VIR_STORAGE_MAX_HEADER - 1; memcpy(desc, buf + 0x200, len); desc[len] =3D '\0'; start =3D strstr(desc, prefix); --=20 2.30.2