harden mo file processing for locale/translations
authorRich Felker <dalias@aerifal.cx>
Tue, 29 Jul 2014 15:48:36 +0000 (11:48 -0400)
committerRich Felker <dalias@aerifal.cx>
Tue, 29 Jul 2014 15:48:36 +0000 (11:48 -0400)
commit6e89210669dfc93302a181a80ed440132e41f0dd
treea78d6870931eed250ebf489ac54abd438a993804
parent73d2a3bfda462eebe8291eb788ef8be567a9add8
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.
src/locale/__mo_lookup.c