[glibmm/glibmm-2-22] MemoryInputStream: Correct data loss/corruption with binary data.



commit e7b46055472bee12d8199a89de53a5b005abef26
Author: Alexey Kosilin <kosilin gmail com>
Date:   Tue Mar 23 18:17:33 2010 +0100

    MemoryInputStream: Correct data loss/corruption with binary data.
    
      * gio/src/memoryinputstream.ccg: add_data(): Use g_memdup() instead of
        g_strdup() on data that could have a null in the middle.
        Bug #609552 (Holger Seelig)

 ChangeLog                     |    8 ++++++++
 gio/src/memoryinputstream.ccg |    2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cfcceac..82ac666 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-23  Alexey Kosilin  <kosilin gmail com>
+
+    MemoryInputStream: Correct data loss/corruption with binary data.
+
+	* gio/src/memoryinputstream.ccg: add_data(): Use g_memdup() instead of 
+    g_strdup() on data that could have a null in the middle.
+    Bug #609552 (Holger Seelig)
+
 2010-03-10  David King  <davidk openismus com>
 
 	Reorder assignment to LDADD and giomm_ldadd in tests/Makefile.am
diff --git a/gio/src/memoryinputstream.ccg b/gio/src/memoryinputstream.ccg
index 7f6aaf8..0801e02 100644
--- a/gio/src/memoryinputstream.ccg
+++ b/gio/src/memoryinputstream.ccg
@@ -37,7 +37,7 @@ void MemoryInputStream::add_data(const void* data, gssize len)
   if (len < 0)
     data_copy = g_strdup (static_cast<const gchar*>(data));
   else
-    data_copy = g_strndup (static_cast<const gchar*>(data), len);
+    data_copy = static_cast<gchar*>(g_memdup (data, len));
 
   g_memory_input_stream_add_data(gobj(), data_copy, len, g_free);
 }



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