From 7f9185383f119c0f9bebd71e81ce08a883139417 Mon Sep 17 00:00:00 2001 From: imura Date: Sat, 23 Jul 2005 16:52:57 +0000 Subject: Temporary restore a part of rev 1.6. We must not increase a capability of buffer size here, because codes which call these functions expect that dst and src are the same size. This will cause problem when someone convert a character whose length is different between charsets on smbfs which was changed to use xlat16 converter. --- sys/libkern/iconv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/libkern/iconv.c b/sys/libkern/iconv.c index 389f21a..5bc1fdf 100644 --- a/sys/libkern/iconv.c +++ b/sys/libkern/iconv.c @@ -458,8 +458,7 @@ iconv_convstr(void *handle, char *dst, const char *src) strcpy(dst, src); return dst; } - inlen = strlen(src); - outlen = inlen * 3; + inlen = outlen = strlen(src); error = iconv_conv(handle, NULL, NULL, &p, &outlen); if (error) return NULL; @@ -484,8 +483,7 @@ iconv_convmem(void *handle, void *dst, const void *src, int size) memcpy(dst, src, size); return dst; } - inlen = size; - outlen = inlen * 3; + inlen = outlen = size; error = iconv_conv(handle, NULL, NULL, &d, &outlen); if (error) return NULL; -- cgit v1.1