From owner-freebsd-arch@FreeBSD.ORG Tue Dec 13 17:36:55 2005 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E4EB016A41F for ; Tue, 13 Dec 2005 17:36:55 +0000 (GMT) (envelope-from babkin@verizon.net) Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B82043D60 for ; Tue, 13 Dec 2005 17:36:55 +0000 (GMT) (envelope-from babkin@verizon.net) Received: from vms076.mailsrvcs.net ([192.168.1.1]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IRG007R1665U3A3@vms046.mailsrvcs.net> for arch@freebsd.org; Tue, 13 Dec 2005 11:34:53 -0600 (CST) Date: Tue, 13 Dec 2005 11:34:53 -0600 (CST) From: Sergey Babkin To: Poul-Henning Kamp , George Paplas Message-id: <12481749.1134495293852.JavaMail.root@vms076.mailsrvcs.net> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Cc: Peter Jeremy , arch@freebsd.org Subject: Re: Re: printf behaviour with illegal or malformed format string X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: babkin@users.sf.net List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2005 17:36:56 -0000 >From: Poul-Henning Kamp >In message <20051212223115.46960.qmail@web36306.mail.mud.yahoo.com>, George Paplas writes: >> >> >>--- Poul-Henning Kamp 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