From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14526 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Some problems with the Strxfrm() function and the Wcsxfrm() function in the MUSL Lic Date: Wed, 7 Aug 2019 12:42:09 -0400 Message-ID: <20190807164209.GC9017@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="229885"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) Cc: musl@lists.openwall.com To: jiahao jia Original-X-From: musl-return-14542-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 07 18:42:26 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1hvP18-000xiT-9G for gllmg-musl@m.gmane.org; Wed, 07 Aug 2019 18:42:26 +0200 Original-Received: (qmail 31793 invoked by uid 550); 7 Aug 2019 16:42:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 31761 invoked from network); 7 Aug 2019 16:42:22 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14526 Archived-At: On Wed, Aug 07, 2019 at 11:57:36PM +0800, jiahao jia wrote: > Dear Rich Felker: > > When I was referring to your code, I found that there were some > problems with the Strxfrm() function and the Wcsxfrm() function in the MUSL > Lic library. The two functions are located in the > “musl-1.1.23\src\locale” directory. The original codes are as follows: > > > > As for the Strxfrm() function, when n = l or n < l, the copy string > function is not executed. > As for the Wcsxfrm() function, when n = 1, l = 2, a character of the > source string is not copied, but only one ‘\0’. > > In response to the above questions, I made the following changes: > > > I am looking forward to your reply as soon as possible! It looks like you intended to include or attach a patch but there doesn't seem to be any. Note that, per the specification: "If the value returned is n or more, the contents of the array pointed to by s1 are unspecified." So unless I'm missing something by not seeing your patch, I think both functions are currently correct, but the inconsistency might not make sense to keep. If we want to change it we should think about what behavior would be help catch errors and reduce danger of incorrect programs that expect a meaningful result. Rich