summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/String.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/String.cc b/lib/String.cc
index 3d13efd..b4d0f6a 100644
--- a/lib/String.cc
+++ b/lib/String.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: String.cc,v 1.50 2008-01-25 13:43:50 pixel Exp $ */
+/* $Id: String.cc,v 1.51 2008-01-29 14:10:40 pixel Exp $ */
#include <stdio.h>
#include <string.h>
@@ -598,11 +598,13 @@ String & String::iconv(const String & from, const String & _to) {
siz = outbuf - t;
- // let's pad up to 2 bytes in order to be safe with wchar_t's
- str = (char *) malloc(siz + 2);
+ // let's pad up to 4 bytes in order to be safe with wchar_t's
+ str = (char *) malloc(siz + 4);
memcpy(str, t, siz);
- str[siz] = 0;
+ str[siz + 0] = 0;
str[siz + 1] = 0;
+ str[siz + 2] = 0;
+ str[siz + 3] = 0;
UNLOCK;
iconv_close(cd);