path: root/lib/empty
diff options
authorRich Felker <>2014-07-31 12:05:25 -0400
committerRich Felker <>2014-07-31 12:05:25 -0400
commit5059deb1a5bf33632390461f3137ebd3dc902e6e (patch)
treef75605ab06626dbff3722ee2a36f75e1a0f4c56f /lib/empty
parentecc082c61b6da9a8b2ae0c07aa3331673834d94a (diff)
harden locale name handling and prevent slashes in LC_MESSAGES
the code which loads locale files was already rejecting locale names containing slashes. however, LC_MESSAGES records a locale name even if libc does not have a matching locale file, so that gettext or application code can use the recorded locale name for message translations to languages that libc does not support. this recorded name was not being checked for slashes, meaning that such code could potentially be tricked into directory traversal. in addition, since the value of a locale category is sometimes used as a pathname component by callers, the improved code rejects any value beginning with a dot. this prevents traversal to the parent directory via "..", use of the top-level locale directory via ".", and also avoids "hidden" directories as a side effect. finally, overly long locale names are now rejected (treated as an unrecognized name and thus as an alias for C.UTF-8) rather than being truncated.
Diffstat (limited to 'lib/empty')
0 files changed, 0 insertions, 0 deletions