Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Mar 2001 15:13:34 -0800
From:      Kris Kennaway <kris@obsecurity.org>
To:        audit@FreeBSD.org
Cc:        cracauer@freebsd.org, bde@freebsd.org
Subject:   -Wnon-const-format patches, Pt 1
Message-ID:  <20010303151334.A33979@mollari.cthul.hu>

next in thread | raw e-mail | index | archive | help

--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

These are the patches I have so far for format string warnings with
-Wnon-const-format, covering the bin/ tree.  Please review (especially
whether I've got all the __printflike/__printf0like attributes correct
-- the difference being whether the function gracefully handles a NULL
format string, like the err() family, or through explicit checks).

More to follow, but I don't want to overwhelm people.

Kris

Index: rcp/extern.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mnt/ncvs/src/bin/rcp/extern.h,v
retrieving revision 1.5
diff -u -r1.5 extern.h
--- rcp/extern.h	1999/08/27 23:14:57	1.5
+++ rcp/extern.h	2001/03/03 23:05:33
@@ -46,6 +46,6 @@
 void	 lostconn __P((int));
 void	 nospace __P((void));
 int	 okname __P((char *));
-void	 run_err __P((const char *, ...));
+void	 run_err __P((const char *, ...)) __printflike(1,2);
 int	 susystem __P((char *, int));
 void	 verifydir __P((char *));
Index: rcp/rcp.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mnt/ncvs/src/bin/rcp/rcp.c,v
retrieving revision 1.26
diff -u -r1.26 rcp.c
--- rcp/rcp.c	2000/02/24 21:21:15	1.26
+++ rcp/rcp.c	2001/03/03 23:05:57
@@ -106,10 +106,11 @@
=20
 #ifdef KERBEROS
 int	 kerberos __P((char **, char *, char *, char *));
-void	 oldw __P((const char *, ...));
+void	 oldw __P((const char *, ...)) __printflike(1,2);
 #endif
 int	 response __P((void));
 void	 rsource __P((char *, struct stat *));
+void	 run_err __P((const char *, ...)) __printflike(1,2);
 void	 sink __P((int, char *[]));
 void	 source __P((int, char *[]));
 void	 tolocal __P((int, char *[]));
Index: sh/error.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mnt/ncvs/src/bin/sh/error.c,v
retrieving revision 1.15
diff -u -r1.15 error.c
--- sh/error.c	1999/11/29 19:10:58	1.15
+++ sh/error.c	2001/03/01 09:58:29
@@ -70,7 +70,7 @@
 char *commandname;
=20
=20
-static void exverror __P((int, char *, va_list));
+static void exverror __P((int, char *, va_list)) __printf0like(2,0);
=20
 /*
  * Called to raise an exception.  Since C doesn't include exceptions, we
Index: sh/error.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mnt/ncvs/src/bin/sh/error.h,v
retrieving revision 1.12
diff -u -r1.12 error.h
--- sh/error.h	2000/04/20 09:49:15	1.12
+++ sh/error.h	2001/03/01 09:56:15
@@ -91,8 +91,8 @@
=20
 void exraise __P((int));
 void onint __P((void));
-void error __P((char *, ...));
-void exerror __P((int, char *, ...));
+void error __P((char *, ...)) __printf0like(1,2);
+void exerror __P((int, char *, ...)) __printf0like(2,3);
 char *errmsg __P((int, int));
=20
=20
Index: sh/mknodes.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mnt/ncvs/src/bin/sh/mknodes.c,v
retrieving revision 1.11
diff -u -r1.11 mknodes.c
--- sh/mknodes.c	1999/11/29 19:11:01	1.11
+++ sh/mknodes.c	2001/03/01 09:58:58
@@ -112,7 +112,7 @@
 static int nextfield __P((char *));
 static void skipbl __P((void));
 static int readline __P((void));
-static void error __P((const char *, ...));
+static void error __P((const char *, ...)) __printf0like(1,2);
 static char *savestr __P((const char *));
=20
=20
Index: sh/output.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mnt/ncvs/src/bin/sh/output.h,v
retrieving revision 1.8
diff -u -r1.8 output.h
--- sh/output.h	1999/08/27 23:15:22	1.8
+++ sh/output.h	2001/03/03 23:09:14
@@ -68,11 +68,11 @@
 void flushall __P((void));
 void flushout __P((struct output *));
 void freestdout __P((void));
-void outfmt __P((struct output *, char *, ...));
-void out1fmt __P((char *, ...));
-void dprintf __P((char *, ...));
-void fmtstr __P((char *, int, char *, ...));
-void doformat __P((struct output *, char *, va_list));
+void outfmt __P((struct output *, char *, ...)) __printflike(2,3);
+void out1fmt __P((char *, ...)) __printflike(1,2);
+void dprintf __P((char *, ...)) __printflike(1,2);
+void fmtstr __P((char *, int, char *, ...)) __printflike(3,4);
+void doformat __P((struct output *, char *, va_list)) __printflike(2,0);
 int xwrite __P((int, char *, int));
 int xioctl __P((int, unsigned long, char *));
=20
Index: sh/show.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mnt/ncvs/src/bin/sh/show.h,v
retrieving revision 1.8
diff -u -r1.8 show.h
--- sh/show.h	2000/04/20 11:39:11	1.8
+++ sh/show.h	2001/03/03 23:09:51
@@ -36,7 +36,7 @@
=20
 void showtree __P((union node *));
 #ifdef DEBUG
-void sh_trace __P((const char *, ...));
+void sh_trace __P((const char *, ...)) __printflike(1,2);
 void trargs __P((char **));
 void trputc __P((int));
 void trputs __P((char *));
Index: sh/bltin/bltin.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mnt/ncvs/src/bin/sh/bltin/bltin.h,v
retrieving revision 1.10
diff -u -r1.10 bltin.h
--- sh/bltin/bltin.h	1999/08/27 23:15:30	1.10
+++ sh/bltin/bltin.h	2001/03/01 10:00:22
@@ -85,7 +85,7 @@
=20
 #ifdef __STDC__
 pointer stalloc(int);
-void error(char *, ...);
+void error(char *, ...) __printf0like(1,2);
 #else
 pointer stalloc();
 void error();


--MGYHOYXEY6WxJCY8
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE6oXqeWry0BWjoQKURAvxtAJ9Ew3eeQvYLiAbcNm48ckCQhSX5OQCg28JU
nFhtB7Jb6gCHE6eXX59zO1I=
=StU4
-----END PGP SIGNATURE-----

--MGYHOYXEY6WxJCY8--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




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