Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 17 Mar 2017 15:37:40 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Re: a bug in bindtextdomain() and strip '.UTF-8'

On Fri, Mar 17, 2017 at 03:27:49PM -0400, Rich Felker wrote:
> +		/* Logically split @mod suffix from locale name. */
> +		modname = memchr(locname, '@', loclen);
> +		if (!modname) modname = locname + loclen;
> +		alt_modlen = modlen = loclen - (modname-locname);
> +		loclen = modname-locname;
> +
> +		/* Drop .charset identifier; it is not used. */
> +		const char *csp = memchr(locname, '.', loclen);
> +		if (csp) loclen = csp-locname;
> +
> +		char name[dirlen+1 + loclen+1 + catlen+1 + domlen+3 + 1];
> +		const void *map;

One bug in my version: loclen+1 should be loclen+modlen+1. Without
changing that, the pathname gets truncated if @mod is used. Otherwise
it seems to work.

One separate but related problem I noticed while testing is that
musl's locale name length limit of 16 is insufficient for something
like "en_GB.UTF-8@...o". If we want to allow users to have an explicit
".UTF-8" in the locale name (which, as we discussed a while back,
users may want to do if they plan to ssh into glibc-based systems)
then we should probably increase this limit a bit, perhaps to 24 or
so.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.