From b1d3f53eaf5b8ba8c16b292827688bf71946d09a Mon Sep 17 00:00:00 2001 From: handa Date: Tue, 4 Oct 2005 11:38:58 +0000 Subject: [PATCH] (mtext_serialize): Be sure to make mt MTEXT_FORMAT_UTF_8 and NULL terminated. --- src/textprop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/textprop.c b/src/textprop.c index e18f5f5..12fa41f 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -2855,6 +2855,11 @@ mtext_serialize (MText *mt, int from, int to, MPlist *property_list) int n; M_CHECK_RANGE (mt, from, to, NULL, NULL); + if (mt->format != MTEXT_FORMAT_US_ASCII + && mt->format != MTEXT_FORMAT_UTF_8) + mtext__adjust_format (mt, MTEXT_FORMAT_UTF_8); + if (MTEXT_DATA (mt)[mtext_nbytes (mt)] != 0) + MTEXT_DATA (mt)[mtext_nbytes (mt)] = 0; doc = xmlParseMemory (XML_TEMPLATE, strlen (XML_TEMPLATE) + 1); node = xmlDocGetRootElement (doc); -- 1.7.10.4