[dovecot-cvs] dovecot/src/lib-charset charset-iconv.c,1.5,1.6
cras at procontrol.fi
cras at procontrol.fi
Sun Dec 1 20:16:37 EET 2002
Update of /home/cvs/dovecot/src/lib-charset
In directory danu:/tmp/cvs-serv20774/lib-charset
Modified Files:
charset-iconv.c
Log Message:
We shouldn't be strdup()ing the buffer, it's not \0 terminated.
Index: charset-iconv.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-charset/charset-iconv.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- charset-iconv.c 15 Nov 2002 06:40:07 -0000 1.5
+++ charset-iconv.c 1 Dec 2002 18:16:35 -0000 1.6
@@ -116,8 +116,11 @@
size_t inleft, outleft, outsize, pos;
if (charset == NULL || strcasecmp(charset, "us-ascii") == 0 ||
- strcasecmp(charset, "ascii") == 0)
- return str_ucase(t_strdup_noconst(buf));
+ strcasecmp(charset, "ascii") == 0) {
+ outbuf = t_malloc(*size);
+ memcpy(outbuf, buf, *size);
+ return str_ucase(outbuf);
+ }
cd = iconv_open("UTF-8", charset);
if (cd == (iconv_t)-1) {
More information about the dovecot-cvs
mailing list