From owner-freebsd-current@FreeBSD.ORG Tue Aug 23 14:35:01 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E502516A41F for ; Tue, 23 Aug 2005 14:35:01 +0000 (GMT) (envelope-from cejkar@fit.vutbr.cz) Received: from kazi.fit.vutbr.cz (kazi.fit.vutbr.cz [147.229.8.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id 45F5C43D45 for ; Tue, 23 Aug 2005 14:35:00 +0000 (GMT) (envelope-from cejkar@fit.vutbr.cz) Received: from kazi.fit.vutbr.cz (localhost [127.0.0.1]) by kazi.fit.vutbr.cz (envelope-from cejkar@fit.vutbr.cz) (8.13.4/8.13.4) with ESMTP id j7NEYwrT027958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 23 Aug 2005 16:34:58 +0200 (CEST) Received: (from cejkar@localhost) by kazi.fit.vutbr.cz (8.13.4/8.13.1/Submit) id j7NEYuOA027957; Tue, 23 Aug 2005 16:34:56 +0200 (CEST) (envelope-from cejkar@fit.vutbr.cz) X-Authentication-Warning: kazi.fit.vutbr.cz: cejkar set sender to cejkar@fit.vutbr.cz using -f Date: Tue, 23 Aug 2005 16:34:56 +0200 From: Rudolf Cejka To: "R. Imura" Message-ID: <20050823143456.GA79107@fit.vutbr.cz> References: <20050821092816.GA51886%imura@ryu16.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050821092816.GA51886%imura@ryu16.org> User-Agent: Mutt/1.4.2.1i X-Scanned-By: MIMEDefang 2.49 on 147.229.8.12 Cc: current@freebsd.org Subject: Re: kiconv related enhancement X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2005 14:35:02 -0000 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 http://www.fit.vutbr.cz/~cejkar Brno University of Technology, Faculty of Information Technology Bozetechova 2, 612 66 Brno, Czech Republic