History log of /seL4-camkes-master/projects/musllibc/src/locale/__mo_lookup.c
Revision Date Author Comments
# 6e892106 29-Jul-2014 Rich Felker <dalias@aerifal.cx>

harden mo file processing for locale/translations

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.


# 41421d6b 26-Jul-2014 Rich Felker <dalias@aerifal.cx>

implement mo file string lookup for translations

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.