From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnsnI-0006Dp-Hp for qemu-devel@nongnu.org; Tue, 03 Dec 2013 11:25:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnsnB-0006rX-Ui for qemu-devel@nongnu.org; Tue, 03 Dec 2013 11:25:52 -0500 Date: Tue, 3 Dec 2013 18:29:16 +0200 From: "Michael S. Tsirkin" Message-ID: <1386087086-3691-21-git-send-email-mst@redhat.com> References: <1386087086-3691-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1386087086-3691-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PATCH 20/23] zaurus: fix buffer overrun on invalid state load List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org CVE-2013-4540 Within scoop_gpio_handler_update, if prev_level has a high bit set, then we get bit > 16 and that does a buffer overrun. Since prev_level comes from wire indirectly, this can happen on invalid state load. To fix, limit to 16 bit. Signed-off-by: Michael S. Tsirkin --- hw/gpio/zaurus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/gpio/zaurus.c b/hw/gpio/zaurus.c index dc79a8b..f3b02c3 100644 --- a/hw/gpio/zaurus.c +++ b/hw/gpio/zaurus.c @@ -60,7 +60,7 @@ struct ScoopInfo { #define SCOOP_GPRR 0x28 static inline void scoop_gpio_handler_update(ScoopInfo *s) { - uint32_t level, diff; + uint16_t level, diff; int bit; level = s->gpio_level & s->gpio_dir; -- MST