Re: unsafe printing
Re: unsafe printing
- Subject: Re: unsafe printing
- From: Steve Mills <email@hidden>
- Date: Fri, 10 Jul 2015 20:07:41 +0000 (GMT)
On Jul 10, 2015, at 02:57 PM, "Jan E. Schotsman" <email@hidden> wrote:
How can I get rid of warnings about unsafe use of printf?
char myString[256];
// set myString in some untransparent way
printf( myString ); // warning: format string is not a literal
Temporarily turn off the warning:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
printf(myString);
#pragma GCC diagnostic pop
Better yet, don't do that, *because it's potentially insecure*. Just do this instead:
printf("%s", myString);
Sent from iCloud (got I hate this editor)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden