Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 05 Aug 2017 11:43:17 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 221224] setlocale.c does not properly detect if locale contains too many slashes
Message-ID:  <bug-221224-8-HeWEAWdM5U@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-221224-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-221224-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221224

--- Comment #1 from Leonard K=C3=B6nig <leonard.r.koenig@googlemail.com> ---
i actually does get increased in line 172 so it does actually count the num=
ber
of sequences of slashes in the locale string (correctly).

But while this works, setting i to 1 within a loop that doesn't use i is ve=
ry
confusing (as is the rest of the code).

But even while i correctly counts the number of slashes it silently assumes
that slashes are only used as separators between locales in a compound loca=
le
-- leading and trailing slashes are thus also counted which results in eg.
"/1/2/3/4/5/6" to be seen as having 6 slashes (correct) but 6+1 locales
(incorrect) in line 164 and also the first locale to be set to "/", the sec=
ond
to "1/" and the 6th to "5/".

Ie: setlocale(LC_ALL, "/1/2/3/4/5/6") calls strlcpy(new_categories[i], loca=
le,
len+1) with:

 i | locale         | len+1 | (new) categories[i]
---|----------------|-------|---------------------
 1 | "/1/2/3/4/5/6" | 1     | "/"
 2 | "1/2/3/4/5/6"  | 2     | "1/"
 3 | "2/3/4/5/6"    | 2     | "2/"
 4 | "3/4/5/6"      | 2     | "3/"
 5 | "4/5/6"        | 2     | "4/"
 6 | "5/6"          | 2     | "5/"

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-221224-8-HeWEAWdM5U>