printf behaviour with illegal or malformed format string

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Dec 12 17:29:08 PST 2005


In message <20051212223115.46960.qmail at web36306.mail.mud.yahoo.com>, George Paplas writes:
>
>
>--- Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
>
>> >>If it is not set, the format string will be output unformatted in
>> >>the message "WARNING: Illegal printf() format string: \"...\".
>> >
>> >Since this check presumably applies to the entire *printf() family,
>> >where do you report the error for {s,f}printf()?
>> 
>> Whereever the strings was meant to go, what else can I do ?
>
>And what if you are doing an sprintf to a buffer smaller than your
>warning message?

"Too f**king bad"

It's the programmer who's made a mess in the first place, so he
can't really make many demands in this situation...

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list