From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G2BC0-0007Ud-I8 for qemu-devel@nongnu.org; Sun, 16 Jul 2006 14:18:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G2BBz-0007U4-UA for qemu-devel@nongnu.org; Sun, 16 Jul 2006 14:18:12 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G2BBz-0007Tr-Pf for qemu-devel@nongnu.org; Sun, 16 Jul 2006 14:18:11 -0400 Received: from [70.116.9.243] (helo=localhost.localdomain) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1G2BEU-0007Gw-HR for qemu-devel@nongnu.org; Sun, 16 Jul 2006 14:20:46 -0400 Received: from localhost ([127.0.0.1]) by localhost.localdomain with esmtp (Exim 4.60) (envelope-from ) id 1G2B7r-0001NY-7y for qemu-devel@nongnu.org; Sun, 16 Jul 2006 13:13:55 -0500 Message-ID: <44BA81E1.2000209@codemonkey.ws> Date: Sun, 16 Jul 2006 13:13:53 -0500 From: Anthony Liguori MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060805090105030604040408" Subject: [Qemu-devel] [PATCH 2/4] Fix an overflow in term_puts Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------060805090105030604040408 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Regards, Anthony Liguori --------------060805090105030604040408 Content-Type: text/x-patch; name="term_puts.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="term_puts.diff" # HG changeset patch # User anthony@localhost.localdomain # Node ID 1cc1aeb53497fcc70843d8fb102da18f1af7e40e # Parent 0b4c6f94ee520884063f11f4631185368998cf9c Fix potential overflow in term_puts() diff -r 0b4c6f94ee52 -r 1cc1aeb53497 monitor.c --- a/monitor.c Sun Jul 16 16:25:28 2006 +++ b/monitor.c Sun Jul 16 16:26:39 2006 @@ -82,8 +82,11 @@ c = *str++; if (c == '\0') break; - if (c == '\n') + if (c == '\n') { term_outbuf[term_outbuf_index++] = '\r'; + if (term_outbuf_index >= sizeof(term_outbuf) - 1) + term_flush(); + } term_outbuf[term_outbuf_index++] = c; if (term_outbuf_index >= (sizeof(term_outbuf) - 1) || c == '\n') --------------060805090105030604040408--