[Bug 221224] setlocale.c does not properly detect if locale contains too many slashes
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Aug 5 11:43:19 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221224
--- Comment #1 from Leonard König <leonard.r.koenig at googlemail.com> ---
i actually does get increased in line 172 so it does actually count the number
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 very
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 locale
-- 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 second
to "1/" and the 6th to "5/".
Ie: setlocale(LC_ALL, "/1/2/3/4/5/6") calls strlcpy(new_categories[i], locale,
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/"
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list