qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/4] Fix an overflow in term_puts
Date: Sun, 16 Jul 2006 13:13:53 -0500	[thread overview]
Message-ID: <44BA81E1.2000209@codemonkey.ws> (raw)

[-- Attachment #1: Type: text/plain, Size: 26 bytes --]

Regards,

Anthony Liguori

[-- Attachment #2: term_puts.diff --]
[-- Type: text/x-patch, Size: 727 bytes --]

# 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')

             reply	other threads:[~2006-07-16 18:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-16 18:13 Anthony Liguori [this message]
2006-07-16 18:25 ` [Qemu-devel] Re: [PATCH 2/4] Fix an overflow in term_puts Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44BA81E1.2000209@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).