Re: kiconv related enhancement

From: Rudolf Cejka <cejkar_at_fit.vutbr.cz>
Date: Tue, 23 Aug 2005 16:34:56 +0200
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
Received on Tue Aug 23 2005 - 12:35:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:42 UTC