From nobody Fri Nov 7 02:13:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15459116724765.651521391628421; Thu, 27 Dec 2018 03:54:32 -0800 (PST) Received: from localhost ([127.0.0.1]:51391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcUF7-0006Rz-QZ for importer@patchew.org; Thu, 27 Dec 2018 06:54:25 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcUDu-0005iZ-7K for qemu-devel@nongnu.org; Thu, 27 Dec 2018 06:53:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gcUDq-0003Ir-Qs for qemu-devel@nongnu.org; Thu, 27 Dec 2018 06:53:10 -0500 Received: from mail-gateway-shared02.cyon.net ([194.126.200.224]:53040) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gcUDq-0003Gq-Gs for qemu-devel@nongnu.org; Thu, 27 Dec 2018 06:53:06 -0500 Received: from s013.cyon.net ([149.126.4.22]) by mail-gateway-shared02.cyon.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim) (envelope-from ) id 1gcUDk-0005lE-TN for qemu-devel@nongnu.org; Thu, 27 Dec 2018 12:53:03 +0100 Received: from [10.20.10.233] (port=50272 helo=mail.cyon.ch) by s013.cyon.net with esmtpa (Exim 4.91) (envelope-from ) id 1gcUDj-003BE4-NA; Thu, 27 Dec 2018 12:52:59 +0100 Received: from hansmi by lepus.hansmi.ch with local (Exim 4.89) (envelope-from ) id 1gcUDj-0001hu-6r; Thu, 27 Dec 2018 11:52:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hansmi.ch; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=wzIMTble6C1BbDBSY6gXzkNcmvF9EHOX4ijSUV05AQU=; b=YRIXv231JCf52Eh+zHlqd8EcvH hdCd5GH/y9Q82/07CCfrlz2DI7Br0+qQkby5elJu44egvKaIX7znaBppeqW97PmIwFUzyz3uhST2r mXNY2QWDQUDdXZzRd2x/6f+iZ3+8pq9Osn+xccweOZtqdkb/8VN76+gJTXn8UzMkLugc=; From: Michael Hanselmann To: qemu-devel@nongnu.org Date: Thu, 27 Dec 2018 11:51:55 +0000 Message-Id: X-Mailer: git-send-email 2.11.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - s013.cyon.net X-AntiAbuse: Original Domain - nongnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - hansmi.ch X-Get-Message-Sender-Via: s013.cyon.net: authenticated_id: mailrelay-cervus@hansmi.ch X-Authenticated-Sender: s013.cyon.net: mailrelay-cervus@hansmi.ch X-Source: X-Source-Args: X-Source-Dir: X-OutGoing-Spam-Status: No, score=-0.8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.126.200.224 Subject: [Qemu-devel] [PATCH] smbus_eeprom: Limit data writes to 255 bytes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, Michael Hanselmann , mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The "eeprom_write_data" function in "smbus_eeprom.c" had no provisions to limit the length of data written. If a caller were able to manipulate the "len" parameter they could potentially write before or after the target buffer. --- hw/i2c/smbus_eeprom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index f18aa3de35..74fa1c328c 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -76,6 +76,7 @@ static void eeprom_write_data(SMBusDevice *dev, uint8_t c= md, uint8_t *buf, int l It is a block write without a length byte. Fortunately we get the full block anyway. */ /* TODO: Should this set the current location? */ + len &=3D 0xff; if (cmd + len > 256) n =3D 256 - cmd; else --=20 2.11.0