From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnsnF-0006BS-BX for qemu-devel@nongnu.org; Tue, 03 Dec 2013 11:25:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vnsn8-0006qP-Ik for qemu-devel@nongnu.org; Tue, 03 Dec 2013 11:25:49 -0500 Date: Tue, 3 Dec 2013 18:29:11 +0200 From: "Michael S. Tsirkin" Message-ID: <1386087086-3691-19-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 18/23] ssd0323: fix buffer overun 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-4538 s->cmd_len used as index in ssd0323_transfer() to store 32-bit field. Possible this field might then be supplied by guest to overwrite a return addr somewhere. Same for row/col fields, which are indicies into framebuffer array. To fix validate after load. Signed-off-by: Michael S. Tsirkin --- hw/display/ssd0323.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c index c3231c6..2c82598 100644 --- a/hw/display/ssd0323.c +++ b/hw/display/ssd0323.c @@ -312,6 +312,9 @@ static int ssd0323_load(QEMUFile *f, void *opaque, int version_id) return -EINVAL; s->cmd_len = qemu_get_be32(f); + if (s->cmd_len < 0 || s->cmd_len > ARRAY_SIZE(s->cmd_data)) { + return -EINVAL; + } s->cmd = qemu_get_be32(f); for (i = 0; i < 8; i++) s->cmd_data[i] = qemu_get_be32(f); -- MST