qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/4] Fix an overflow in term_puts
@ 2006-07-16 18:13 Anthony Liguori
  2006-07-16 18:25 ` [Qemu-devel] " Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony Liguori @ 2006-07-16 18:13 UTC (permalink / raw)
  To: qemu-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [PATCH 2/4] Fix an overflow in term_puts
  2006-07-16 18:13 [Qemu-devel] [PATCH 2/4] Fix an overflow in term_puts Anthony Liguori
@ 2006-07-16 18:25 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2006-07-16 18:25 UTC (permalink / raw)
  To: qemu-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-16 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-16 18:13 [Qemu-devel] [PATCH 2/4] Fix an overflow in term_puts Anthony Liguori
2006-07-16 18:25 ` [Qemu-devel] " Anthony Liguori

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).