From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G2BNy-0004kt-4Y for qemu-devel@nongnu.org; Sun, 16 Jul 2006 14:30:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G2BNu-0004jK-Ix for qemu-devel@nongnu.org; Sun, 16 Jul 2006 14:30:33 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G2BNu-0004jG-Ck for qemu-devel@nongnu.org; Sun, 16 Jul 2006 14:30:30 -0400 Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1G2BQP-00083O-6p for qemu-devel@nongnu.org; Sun, 16 Jul 2006 14:33:05 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1G2BNm-0000Np-UV for qemu-devel@nongnu.org; Sun, 16 Jul 2006 20:30:22 +0200 Received: from cpe-70-116-9-243.austin.res.rr.com ([70.116.9.243]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 16 Jul 2006 20:30:22 +0200 Received: from anthony by cpe-70-116-9-243.austin.res.rr.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 16 Jul 2006 20:30:22 +0200 From: Anthony Liguori Date: Sun, 16 Jul 2006 13:25:57 -0500 Message-ID: References: <44BA81E1.2000209@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: news Subject: [Qemu-devel] Re: [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 Nevermind on this one. I didn't catch that the - 1 actually prevents an overflow :-) Regards, Anthony Liguori On Sun, 16 Jul 2006 13:13:53 -0500, Anthony Liguori wrote: > Regards, > > Anthony Liguori# 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')_______________________________________________ Qemu-devel mailing list > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel