Module Name:    src
Committed By:   apb
Date:           Sat Jun 14 08:18:24 UTC 2014

Modified Files:
        src/lib/libc/gen: fmtcheck.3 fmtcheck.c

Log Message:
Teach fmtcheck(3) that a pointer and a long are not the same.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/gen/fmtcheck.3
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/gen/fmtcheck.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/fmtcheck.3
diff -u src/lib/libc/gen/fmtcheck.3:1.7 src/lib/libc/gen/fmtcheck.3:1.8
--- src/lib/libc/gen/fmtcheck.3:1.7	Mon Mar  9 19:24:26 2009
+++ src/lib/libc/gen/fmtcheck.3	Sat Jun 14 08:18:24 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: fmtcheck.3,v 1.7 2009/03/09 19:24:26 joerg Exp $
+.\"	$NetBSD: fmtcheck.3,v 1.8 2014/06/14 08:18:24 apb Exp $
 .\"
 .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 17, 2000
+.Dd June 14, 2014
 .Dt FMTCHECK 3
 .Os
 .Sh NAME
@@ -77,11 +77,13 @@ Also, any text other than the format spe
 .Pp
 Note that the formats may be quite different as long as they accept the
 same parameters.
-For example, "%p %o %30s %#llx %-10.*e %n" is
+For example, "%ld %o %30s %#llx %-10.*e %n" is
 compatible with "This number %lu %d%% and string %s has %qd numbers
 and %.*g floats (%n)."
 However, "%o" is not equivalent to "%lx" because
-the first requires an integer and the second requires a long.
+the first requires an integer and the second requires a long,
+and "%p" is not equivalent to "%lu" because
+the first requires a pointer and the second requires a long.
 .Sh RETURN VALUES
 If
 .Fa fmt_suspect

Index: src/lib/libc/gen/fmtcheck.c
diff -u src/lib/libc/gen/fmtcheck.c:1.8 src/lib/libc/gen/fmtcheck.c:1.9
--- src/lib/libc/gen/fmtcheck.c:1.8	Mon Apr 28 20:22:59 2008
+++ src/lib/libc/gen/fmtcheck.c	Sat Jun 14 08:18:24 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fmtcheck.c,v 1.8 2008/04/28 20:22:59 martin Exp $	*/
+/*	$NetBSD: fmtcheck.c,v 1.9 2014/06/14 08:18:24 apb Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fmtcheck.c,v 1.8 2008/04/28 20:22:59 martin Exp $");
+__RCSID("$NetBSD: fmtcheck.c,v 1.9 2014/06/14 08:18:24 apb Exp $");
 #endif
 
 #include "namespace.h"
@@ -49,6 +49,7 @@ enum __e_fmtcheck_types {
 	FMTCHECK_INT,
 	FMTCHECK_LONG,
 	FMTCHECK_QUAD,
+	FMTCHECK_POINTER,
 	FMTCHECK_SHORTPOINTER,
 	FMTCHECK_INTPOINTER,
 	FMTCHECK_LONGPOINTER,
@@ -149,7 +150,7 @@ get_next_format_from_precision(const cha
 	if (*f == 'p') {
 		if (sh + lg + quad + longdouble)
 			RETURN(pf,f,FMTCHECK_UNKNOWN);
-		RETURN(pf,f,FMTCHECK_LONG);
+		RETURN(pf,f,FMTCHECK_POINTER);
 	}
 	RETURN(pf,f,FMTCHECK_UNKNOWN);
 	/*NOTREACHED*/

Reply via email to