Teach fmtcheck(3) that a pointer and a long are not the same.
This commit is contained in:
parent
605674c009
commit
e72cca9651
|
@ -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 specifiers is completely ignored.
|
|||
.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
|
||||
|
|
|
@ -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 char **pf)
|
|||
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*/
|
||||
|
|
Loading…
Reference in New Issue