[gedit] Fixed critical bug reading past buffer boundary



commit da94b577d4591473dd22af116b84f9b800f11603
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sun Feb 28 22:00:32 2010 +0100

    Fixed critical bug reading past buffer boundary
    
    This fixes a critical bug where g_utf8_next_char was reading past
    memory boundary and causing corrupt files.

 gedit/gedit-document-input-stream.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-document-input-stream.c b/gedit/gedit-document-input-stream.c
index 28e4a72..3fcc2aa 100644
--- a/gedit/gedit-document-input-stream.c
+++ b/gedit/gedit-document-input-stream.c
@@ -323,6 +323,12 @@ read_line (GeditDocumentInputStream *stream,
 		do
 		{
 			read = next_size;
+
+			if (read == to_write)
+			{
+				break;
+			}
+
 			ptr = g_utf8_next_char (ptr);
 			next_size = ptr - buf;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]