This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Preparsing sprintf format strings


Ross Ridge wrote:
>The compiler can't in general know what encoding that printf, fprintf,
>and sprintf will use to parse the string.  It's locale dependent.

Bernd Schmidt writes:
>Does this mean it can vary from one run of the program to another? 

Yes, that's the whole point having locales.  So a single program can
work with more than one language.  In fact locales can chage during the
execution of a program.

> I'll admit I don't understand locales very well, but doesn't this
> sound like a recipe for security holes?

A program has to explicitly call setlocale() to change the locale to
anything other than the default "C" locale.

					Ross Ridge


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]