This is the mail archive of the
mailing list for the GCC project.
Re: Preparsing sprintf format strings
- From: rridge at csclub dot uwaterloo dot ca (Ross Ridge)
- To: gcc at gcc dot gnu dot org
- Date: Fri, 12 Oct 2007 17:19:44 -0400 (EDT)
- Subject: 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.