[RFC] newlib/libc/include/langinfo.h: nl_langinfo enum off by one error causing pointer overwrite

Corinna Vinschen vinschen@redhat.com
Thu Aug 22 08:07:17 GMT 2024


Hi Brian,

On Aug 21 17:58, Brian Inglis wrote:
> if __HAVE_LOCALE_INFO__ is defined, then _NL_MESSAGES_CODESET is defined
> instead of _NL_CTYPE_CODESET

There is no _NL_CTYPE_CODESET, only CODESET, and the value of
_NL_MESSAGES_CODESET is what it is for backward compatibility.

The values must not change.

> demonstration of pointer overwrite by nl_langinfo dump program generated
> with additional langinfo.h hack after fix:

Can you please provide your STC?

> if __HAVE_LOCALE_INFO__ is not defined, then _NL_MESSAGES_CODESET is
> also not defined, so it is unclear if _NL_MESSAGES_CODESET should be
> defined to _NL_CTYPE_CODESET if neither __HAVE_LOCALE_INFO__ nor
> __HAVE_LOCALE_INFO_EXTENDED__ are defined, or added as another field
> depending on those definitions

As I wrote above, the values must not change.  And given _NL_CTYPE_CODESET
doesn't really exist (but CODESET does), I'm not sure I understand the
problem here.  As on Linux we have a value _NL_CTYPE_CODESET_NAME which
is equivalent to CODESET.


Corinna



More information about the Newlib mailing list