[gnumeric] xls: fix problem with export of non-ascii strings.



commit 64e8575e0897b7e5fc65cebb69eda99a773a4e64
Author: Morten Welinder <terra gnome org>
Date:   Mon Nov 25 10:00:44 2013 -0500

    xls: fix problem with export of non-ascii strings.

 plugins/excel/ChangeLog        |    4 ++++
 plugins/excel/ms-excel-write.c |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 1d8fce7..0a5ed66 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-25  Morten Welinder  <terra gnome org>
+
+       * ms-excel-write.c (excel_write_string): Fix buffer allocation.
+
 2013-11-22  Morten Welinder  <terra gnome org>
 
        * ms-excel-write.c (excel_write_RSTRING): Truncate markup at text
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 62494e7..68ebd00 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -321,7 +321,7 @@ excel_write_string (BiffPut *bp, WriteStringFlags flags,
 
                /* 2 in case we null terminate, and up to 4 for the length */
                if ((out_bytes + 4 + 2) > bp->buf_len) {
-                       bp->buf_len = ((char_len >> 2) + 1) << 2;
+                       bp->buf_len = (((out_bytes + 6) >> 2) + 1) << 2;
                        bp->buf = g_realloc (bp->buf, bp->buf_len);
                }
 


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