From 0e5f158b527845a980eec37d12f23f035bc2f22f Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 12 May 2000 18:20:47 +0000 Subject: NUL-terminate the data extracted from the BonoboStream. * e-msg-composer.c (get_editor_text): NUL-terminate the data extracted from the BonoboStream. svn path=/trunk/; revision=3005 --- composer/ChangeLog | 5 +++++ composer/e-msg-composer.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index a6fde518af..e4369d88e4 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,8 @@ +2000-05-12 Dan Winship + + * e-msg-composer.c (get_editor_text): NUL-terminate the data + extracted from the BonoboStream. + 2000-05-10 Dan Winship * e-msg-composer-attachment-bar.c (attach_to_multipart): deal with diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index c575a3b800..eab6dfca92 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -107,6 +107,7 @@ get_editor_text (BonoboWidget *editor) { Bonobo_PersistStream persist; BonoboStream *stream; + BonoboStreamMem *stream_mem; CORBA_Environment ev; char *text; @@ -130,7 +131,10 @@ get_editor_text (BonoboWidget *editor) Bonobo_Unknown_unref (persist, &ev); CORBA_exception_free (&ev); - text = g_strdup (bonobo_stream_mem_get_buffer (BONOBO_STREAM_MEM (stream))); + stream_mem = BONOBO_STREAM_MEM (stream); + text = g_malloc (stream_mem->pos + 1); + memcpy (text, stream_mem->buffer, stream_mem->pos); + text[stream_mem->pos] = 0; bonobo_object_unref (BONOBO_OBJECT(stream)); return text; } -- cgit