From 9492e7b62b939c457ae94956b3246bfbb5c43d63 Mon Sep 17 00:00:00 2001 From: Pablo Saratxaga Date: Tue, 7 Jan 2003 17:56:10 +0000 Subject: *** empty log message *** --- perl-install/c/stuff.xs.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'perl-install') diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index f8bfed299..d5b711bd6 100644 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -111,10 +111,13 @@ SV * iconv_(char* s, char* from_charset, char* to_charset) { char* retval = s; if (cd != (iconv_t) (-1)) { size_t s_len = strlen(retval); - char *buf = alloca(3 * s_len + 10); /* 10 for safety, it should not be needed */ + /* the maximum expansion when converting happens when converting + tscii to utf-8; each tscii char can become up to 4 unicode chars + and each one of those unicode chars can be 3 bytes long */ + char *buf = alloca(4 * 3 * s_len); { char *ptr = buf; - size_t ptr_len = 3 * s_len + 10; + size_t ptr_len = 4 * 3 * s_len; if ((iconv(cd, &s, &s_len, &ptr, &ptr_len)) != (size_t) (-1)) { *ptr = 0; retval = buf; -- cgit v1.2.1