summaryrefslogtreecommitdiff
path: root/src/locale/__mo_lookup.c
AgeCommit message (Collapse)AuthorLines
2014-07-29harden mo file processing for locale/translationsRich Felker-2/+6
rather than just checking that the start of the string lies within the mapping, also check that the nominal length remains within the mapping, and that the null terminator is present at the nominal length. this ensures that the caller, using the result as a C string, will not read past the end of the mapping. the nominal length is never exposed to the caller, but it's useful internally to find where the null terminator should be without having to restort to linear search via strnlen/memchr.
2014-07-26implement mo file string lookup for translationsRich Felker-0/+38
the core is based on a binary search; hash table is not used. both native and reverse-endian mo files are supported. all offsets read from the mapped mo file are checked against the mapping size to prevent the possibility of reads outside the mapping. this commit has no observable effects since there are not yet any callers to the message translation code.