kiconv related enhancement
Rudolf Cejka
cejkar at fit.vutbr.cz
Tue Aug 23 14:35:02 GMT 2005
R. Imura wrote (2005/08/21):
> http://people.freebsd.org/~imura/kiconv/
> I'm planning to commit above patches after FreeBSD-6.0 released.
> If you're interested, please test and report.
Hello, big thanks for your work on this! I have tested your patches
and they seem to be good from my user's point of view - see below,
which tables have been loaded and how they are now used.
Please, do you have a plan to fix ranges too? You have either allocate
sufficient space (ICONV_CSNMAXLEN + 1 instead of just ICONV_CSNMAXLEN),
or check for string length >= ICONV_CSNMAXLEN instead of > ICONV_CSNMAXLEN.
The second problem is that some strcpy()s could overwrite one byte
after allocated space and strnpcy()s could produce unterminated
strings - everything is around egrep -r "ICONV_C(S|NV)NMAXLEN" /usr/src.
The last problem is that sys/libkern/iconv.c does not check the length
of from and to in iconv_sysctl_add(), which can be source of unexpected
results.
Old:
====
grep kiconv /etc/rc.local
/usr/local/sbin/kiconvctl add -m -l cs_CZ.ISO8859-2 -t UTF-16BE
/usr/local/sbin/kiconvctl add -m -l cs_CZ.ISO8859-2 -t CP852
kiconvctl list (with forgotten mounted dos partition, but I think that
there would by all Refs = 1)
Loaded Tables
Id Refs From To
1 0 ISO8859-2 UTF-16BE
2 0 UTF-16BE ISO8859-2
3 0 ISO8859-2 CP852
4 0 CP852 ISO8859-2
New:
====
grep kiconv /etc/rc.conf
kiconv_load="YES"
kiconv_locale="cs_CZ.ISO8859-2"
kiconv_encoding="CP852"
kiconvctl list (with one user mounted dos partition)
Loaded Tables
Id Refs From To
1 0 UTF-8 UTF-16BE
2 0 UTF-16BE UTF-8
3 2 ISO8859-2 UTF-16BE
4 2 UTF-16BE ISO8859-2
5 4 ISO8859-2 _wctype
6 1 CP852 UTF-16BE
7 1 UTF-16BE CP852
Regards.
--
Rudolf Cejka <cejkar at fit.vutbr.cz> http://www.fit.vutbr.cz/~cejkar
Brno University of Technology, Faculty of Information Technology
Bozetechova 2, 612 66 Brno, Czech Republic
More information about the freebsd-current
mailing list