From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.emacs.bugs Subject: bug#10592: Bug#655118: Please enabled hardened build flags Date: Tue, 24 Jan 2012 20:22:52 -0600 Message-ID: <8739b45xmr.fsf@trouble.defaultvalue.org> References: <20120108171359.6340.17517.reportbug@pisco.westfalen.local> <20120108180151.GA919@pisco.westfalen.local> <87wr8h8zhu.fsf@trouble.defaultvalue.org> <87pqe98zc9.fsf@trouble.defaultvalue.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1327458230 13117 80.91.229.12 (25 Jan 2012 02:23:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 25 Jan 2012 02:23:50 +0000 (UTC) Cc: 10592@debbugs.gnu.org, 655118-forwarded@bugs.debian.org, jmm@inutil.org, 655118@bugs.debian.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 25 03:23:45 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RpsWW-0003Vt-71 for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Jan 2012 03:23:44 +0100 Original-Received: from localhost ([::1]:35622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpsWV-0002zT-P2 for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Jan 2012 21:23:43 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:40675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpsWS-0002zD-Hy for bug-gnu-emacs@gnu.org; Tue, 24 Jan 2012 21:23:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RpsWR-00020i-Ab for bug-gnu-emacs@gnu.org; Tue, 24 Jan 2012 21:23:40 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37034) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpsWR-00020d-7e for bug-gnu-emacs@gnu.org; Tue, 24 Jan 2012 21:23:39 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RpsWo-0003k0-C3 for bug-gnu-emacs@gnu.org; Tue, 24 Jan 2012 21:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Rob Browning Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Jan 2012 02:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10592 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10592-submit@debbugs.gnu.org id=B10592.132745820714336 (code B ref 10592); Wed, 25 Jan 2012 02:24:02 +0000 Original-Received: (at 10592) by debbugs.gnu.org; 25 Jan 2012 02:23:27 +0000 Original-Received: from localhost ([127.0.0.1]:42421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RpsWE-0003j9-2l for submit@debbugs.gnu.org; Tue, 24 Jan 2012 21:23:27 -0500 Original-Received: from defaultvalue.org ([70.85.129.156]:58425 ident=postfix) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RpsW7-0003is-N2 for 10592@debbugs.gnu.org; Tue, 24 Jan 2012 21:23:24 -0500 Original-Received: from trouble.defaultvalue.org (localhost [127.0.0.1]) (Authenticated sender: rlb@defaultvalue.org) by defaultvalue.org (Postfix) with ESMTPSA id D701590D35; Tue, 24 Jan 2012 20:23:10 -0600 (CST) Original-Received: by trouble.defaultvalue.org (Postfix, from userid 1000) id 0099F14E047; Tue, 24 Jan 2012 20:22:52 -0600 (CST) In-Reply-To: (Eli Zaretskii's message of "Tue, 24 Jan 2012 01:06:40 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:55972 Archived-At: Eli Zaretskii writes: > I think the right fix for this is to declare `error' with the > appropriate printf attribute. Alternatively, you could use variable > argument lists and call vprintf instead. Would something like this be acceptable, and if not, how would you like to see it adjusted? The patch changes error() to use an ANSI declaration, and it relies on the printf format attribute: diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 58add49..6b2fc20 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -60,6 +60,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include #include @@ -152,7 +153,7 @@ extern char *rindex __P((const char *, int)); #endif void fatal (); -void error (); +void error (const char *template, ...) __attribute__ ((format (printf, 1, 2))); void pfatal_with_name (); void pfatal_and_delete (); char *concat (); @@ -610,16 +611,13 @@ fatal (s1, s2, s3) are args for it or null. */ void -error (s1, s2, s3) - char *s1, *s2, *s3; +error (const char *template, ...) { + va_list ap; fprintf (stderr, "movemail: "); - if (s3) - fprintf (stderr, s1, s2, s3); - else if (s2) - fprintf (stderr, s1, s2); - else - fprintf (stderr, s1); + va_start (ap, template); + vfprintf (stderr, template, ap); + va_end (ap); fprintf (stderr, "\n"); } @@ -733,13 +731,13 @@ popmail (mailbox, outfile, preserve, password, reverse_order) server = pop_open (hostname, user, password, POP_NO_GETPASS); if (! server) { - error ("Error connecting to POP server: %s", pop_error, 0); + error ("Error connecting to POP server: %s", pop_error); return EXIT_FAILURE; } if (pop_stat (server, &nmsgs, &nbytes)) { - error ("Error getting message count from POP server: %s", pop_error, 0); + error ("Error getting message count from POP server: %s", pop_error); return EXIT_FAILURE; } @@ -761,7 +759,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order) if ((mbf = fdopen (mbfi, "wb")) == NULL) { pop_close (server); - error ("Error in fdopen: %s", strerror (errno), 0); + error ("Error in fdopen: %s", strerror (errno)); close (mbfi); unlink (outfile); return EXIT_FAILURE; @@ -785,7 +783,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order) mbx_delimit_begin (mbf); if (pop_retr (server, i, mbf) != OK) { - error ("%s", Errmsg, 0); + error ("%s", Errmsg); close (mbfi); return EXIT_FAILURE; } @@ -793,7 +791,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order) fflush (mbf); if (ferror (mbf)) { - error ("Error in fflush: %s", strerror (errno), 0); + error ("Error in fflush: %s", strerror (errno)); pop_close (server); close (mbfi); return EXIT_FAILURE; @@ -809,14 +807,14 @@ popmail (mailbox, outfile, preserve, password, reverse_order) #ifdef BSD_SYSTEM if (fsync (mbfi) < 0) { - error ("Error in fsync: %s", strerror (errno), 0); + error ("Error in fsync: %s", strerror (errno)); return EXIT_FAILURE; } #endif if (close (mbfi) == -1) { - error ("Error in close: %s", strerror (errno), 0); + error ("Error in close: %s", strerror (errno)); return EXIT_FAILURE; } @@ -825,7 +823,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order) { if (pop_delete (server, i)) { - error ("Error from POP server: %s", pop_error, 0); + error ("Error from POP server: %s", pop_error); pop_close (server); return EXIT_FAILURE; } @@ -833,7 +831,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order) if (pop_quit (server)) { - error ("Error from POP server: %s", pop_error, 0); + error ("Error from POP server: %s", pop_error); return EXIT_FAILURE; } -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4