Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Dec 2005 11:34:53 -0600 (CST)
From:      Sergey Babkin <babkin@verizon.net>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>, George Paplas <geopapl@yahoo.com>
Cc:        Peter Jeremy <PeterJeremy@optushome.com.au>, arch@freebsd.org
Subject:   Re: Re: printf behaviour with illegal or malformed format string
Message-ID:  <12481749.1134495293852.JavaMail.root@vms076.mailsrvcs.net>

next in thread | raw e-mail | index | archive | help
>From: Poul-Henning Kamp <phk@phk.freebsd.dk>

>In message <20051212223115.46960.qmail@web36306.mail.mud.yahoo.com>, George Paplas writes:
>>
>>
>>--- Poul-Henning Kamp <phk@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...

Probably the least intrusive thing is to print the original 
message to the best ability of deciphering it, and then
print the error message on stderr (kind of like the message
printed on the first usage of gets() and such).

-SB



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?12481749.1134495293852.JavaMail.root>