summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2011-05-30 18:48:34 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2011-05-30 18:48:34 +0000
commite8e86f50ba5766847341543ad3ae23fd9fb9cdfa (patch)
treed4494067d9a68b8a12bc70fdce778dc9bbcbd7bc /lib
parentafbe27659d775f2cab2735cdcfa8d42dd7a5029a (diff)
Make printf-like and scanf-like functions marked as such in llib-lc.ln
and llib-lwrap.ln databases; so that the lint features doing format strings checks are enabled by default. Looks good to millert@.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/err.c4
-rw-r--r--lib/libc/gen/errx.c4
-rw-r--r--lib/libc/gen/setproctitle.c3
-rw-r--r--lib/libc/gen/syslog.c3
-rw-r--r--lib/libc/gen/syslog_r.c3
-rw-r--r--lib/libc/gen/warn.c4
-rw-r--r--lib/libc/gen/warnx.c4
-rw-r--r--lib/libc/stdio/asprintf.c3
-rw-r--r--lib/libc/stdio/fprintf.c3
-rw-r--r--lib/libc/stdio/fscanf.c3
-rw-r--r--lib/libc/stdio/printf.c3
-rw-r--r--lib/libc/stdio/scanf.c3
-rw-r--r--lib/libc/stdio/snprintf.c3
-rw-r--r--lib/libc/stdio/sprintf.c3
-rw-r--r--lib/libc/stdio/sscanf.c3
-rw-r--r--lib/libwrap/diag.c4
16 files changed, 37 insertions, 16 deletions
diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c
index 3ee4bbcdc88..ff335938214 100644
--- a/lib/libc/gen/err.c
+++ b/lib/libc/gen/err.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: err.c,v 1.9 2005/08/08 08:05:33 espie Exp $ */
+/* $OpenBSD: err.c,v 1.10 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -32,6 +32,7 @@
#include <err.h>
#include <stdarg.h>
+/* PRINTFLIKE2 */
__dead void
_err(int eval, const char *fmt, ...)
{
@@ -42,5 +43,6 @@ _err(int eval, const char *fmt, ...)
va_end(ap);
}
+/* PRINTFLIKE2 */
__weak_alias(err, _err);
diff --git a/lib/libc/gen/errx.c b/lib/libc/gen/errx.c
index 964ff8a3940..688e2576c67 100644
--- a/lib/libc/gen/errx.c
+++ b/lib/libc/gen/errx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: errx.c,v 1.8 2005/08/08 08:05:34 espie Exp $ */
+/* $OpenBSD: errx.c,v 1.9 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -32,6 +32,7 @@
#include <err.h>
#include <stdarg.h>
+/* PRINTFLIKE2 */
__dead void
_errx(int eval, const char *fmt, ...)
{
@@ -42,5 +43,6 @@ _errx(int eval, const char *fmt, ...)
va_end(ap);
}
+/* PRINTFLIKE2 */
__weak_alias(errx, _errx);
diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c
index 569c9c146c8..259c31d3507 100644
--- a/lib/libc/gen/setproctitle.c
+++ b/lib/libc/gen/setproctitle.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setproctitle.c,v 1.11 2005/08/08 08:05:34 espie Exp $ */
+/* $OpenBSD: setproctitle.c,v 1.12 2011/05/30 18:48:33 martynas Exp $ */
/*
* Copyright (c) 1994, 1995 Christopher G. Demetriou
* All rights reserved.
@@ -44,6 +44,7 @@
extern char *__progname; /* Program name, from crt0. */
+/* PRINTFLIKE1 */
void
setproctitle(const char *fmt, ...)
{
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index 46c04a08ddd..e713b64edcf 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslog.c,v 1.30 2009/11/18 07:43:22 guenther Exp $ */
+/* $OpenBSD: syslog.c,v 1.31 2011/05/30 18:48:33 martynas Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -63,6 +63,7 @@ gettime(char *buf, size_t maxsize)
* syslog, vsyslog --
* print message on log file; output is intended for syslogd(8).
*/
+/* PRINTFLIKE2 */
void
syslog(int pri, const char *fmt, ...)
{
diff --git a/lib/libc/gen/syslog_r.c b/lib/libc/gen/syslog_r.c
index 6e38a62d276..2a966a4ba62 100644
--- a/lib/libc/gen/syslog_r.c
+++ b/lib/libc/gen/syslog_r.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslog_r.c,v 1.2 2009/11/21 10:23:31 chl Exp $ */
+/* $OpenBSD: syslog_r.c,v 1.3 2011/05/30 18:48:33 martynas Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -54,6 +54,7 @@ void __vsyslog_r(int pri, struct syslog_data *, size_t (*)(char *, size_t),
/* Reentrant version of syslog, i.e. syslog_r() */
+/* PRINTFLIKE3 */
void
syslog_r(int pri, struct syslog_data *data, const char *fmt, ...)
{
diff --git a/lib/libc/gen/warn.c b/lib/libc/gen/warn.c
index bbff436f59b..4da071155de 100644
--- a/lib/libc/gen/warn.c
+++ b/lib/libc/gen/warn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: warn.c,v 1.8 2005/08/08 08:05:34 espie Exp $ */
+/* $OpenBSD: warn.c,v 1.9 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -32,6 +32,7 @@
#include <err.h>
#include <stdarg.h>
+/* PRINTFLIKE1 */
void
_warn(const char *fmt, ...)
{
@@ -42,5 +43,6 @@ _warn(const char *fmt, ...)
va_end(ap);
}
+/* PRINTFLIKE1 */
__weak_alias(warn, _warn);
diff --git a/lib/libc/gen/warnx.c b/lib/libc/gen/warnx.c
index 42a15778c68..8a94cbd0905 100644
--- a/lib/libc/gen/warnx.c
+++ b/lib/libc/gen/warnx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: warnx.c,v 1.7 2005/08/08 08:05:34 espie Exp $ */
+/* $OpenBSD: warnx.c,v 1.8 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -32,6 +32,7 @@
#include <err.h>
#include <stdarg.h>
+/* PRINTFLIKE1 */
void
_warnx(const char *fmt, ...)
{
@@ -42,5 +43,6 @@ _warnx(const char *fmt, ...)
va_end(ap);
}
+/* PRINTFLIKE1 */
__weak_alias(warnx, _warnx);
diff --git a/lib/libc/stdio/asprintf.c b/lib/libc/stdio/asprintf.c
index d1d023a6b4a..5424c90dc9d 100644
--- a/lib/libc/stdio/asprintf.c
+++ b/lib/libc/stdio/asprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asprintf.c,v 1.18 2009/11/09 00:18:27 kurt Exp $ */
+/* $OpenBSD: asprintf.c,v 1.19 2011/05/30 18:48:33 martynas Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -23,6 +23,7 @@
#include <stdarg.h>
#include "local.h"
+/* PRINTFLIKE2 */
int
asprintf(char **str, const char *fmt, ...)
{
diff --git a/lib/libc/stdio/fprintf.c b/lib/libc/stdio/fprintf.c
index 7415b2fca39..a391142ea25 100644
--- a/lib/libc/stdio/fprintf.c
+++ b/lib/libc/stdio/fprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fprintf.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */
+/* $OpenBSD: fprintf.c,v 1.7 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdarg.h>
+/* PRINTFLIKE2 */
int
fprintf(FILE *fp, const char *fmt, ...)
{
diff --git a/lib/libc/stdio/fscanf.c b/lib/libc/stdio/fscanf.c
index 2f3fcebb21b..5fd10d4a464 100644
--- a/lib/libc/stdio/fscanf.c
+++ b/lib/libc/stdio/fscanf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fscanf.c,v 1.9 2005/10/10 17:37:44 espie Exp $ */
+/* $OpenBSD: fscanf.c,v 1.10 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdarg.h>
+/* SCANFLIKE2 */
int
fscanf(FILE *fp, const char *fmt, ...)
{
diff --git a/lib/libc/stdio/printf.c b/lib/libc/stdio/printf.c
index 614b4351548..09bb3d7f7db 100644
--- a/lib/libc/stdio/printf.c
+++ b/lib/libc/stdio/printf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printf.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
+/* $OpenBSD: printf.c,v 1.8 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdarg.h>
+/* PRINTFLIKE1 */
int
printf(const char *fmt, ...)
{
diff --git a/lib/libc/stdio/scanf.c b/lib/libc/stdio/scanf.c
index 71194d04e7a..90cf12a3ba7 100644
--- a/lib/libc/stdio/scanf.c
+++ b/lib/libc/stdio/scanf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scanf.c,v 1.9 2005/08/08 08:05:36 espie Exp $ */
+/* $OpenBSD: scanf.c,v 1.10 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdarg.h>
+/* SCANFLIKE1 */
int
scanf(const char *fmt, ...)
{
diff --git a/lib/libc/stdio/snprintf.c b/lib/libc/stdio/snprintf.c
index 09659c8fb7d..7b087e95dd1 100644
--- a/lib/libc/stdio/snprintf.c
+++ b/lib/libc/stdio/snprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snprintf.c,v 1.17 2009/11/09 00:18:27 kurt Exp $ */
+/* $OpenBSD: snprintf.c,v 1.18 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -37,6 +37,7 @@
#include <stdarg.h>
#include "local.h"
+/* PRINTFLIKE3 */
int
snprintf(char *str, size_t n, const char *fmt, ...)
{
diff --git a/lib/libc/stdio/sprintf.c b/lib/libc/stdio/sprintf.c
index faa7c73ca20..0ca6b055bad 100644
--- a/lib/libc/stdio/sprintf.c
+++ b/lib/libc/stdio/sprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sprintf.c,v 1.16 2009/11/09 00:18:27 kurt Exp $ */
+/* $OpenBSD: sprintf.c,v 1.17 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -42,6 +42,7 @@ __warn_references(sprintf,
"warning: sprintf() is often misused, please use snprintf()");
#endif
+/* PRINTFLIKE2 */
int
sprintf(char *str, const char *fmt, ...)
{
diff --git a/lib/libc/stdio/sscanf.c b/lib/libc/stdio/sscanf.c
index a0bdf1c5262..ca6b33c9e3c 100644
--- a/lib/libc/stdio/sscanf.c
+++ b/lib/libc/stdio/sscanf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sscanf.c,v 1.12 2005/08/08 08:05:36 espie Exp $ */
+/* $OpenBSD: sscanf.c,v 1.13 2011/05/30 18:48:33 martynas Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -44,6 +44,7 @@ eofread(void *cookie, char *buf, int len)
return (0);
}
+/* SCANFLIKE2 */
int
sscanf(const char *str, const char *fmt, ...)
{
diff --git a/lib/libwrap/diag.c b/lib/libwrap/diag.c
index 0b8ff2f7f55..9601e165a4c 100644
--- a/lib/libwrap/diag.c
+++ b/lib/libwrap/diag.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diag.c,v 1.5 2009/10/27 23:59:30 deraadt Exp $ */
+/* $OpenBSD: diag.c,v 1.6 2011/05/30 18:48:33 martynas Exp $ */
/*
* Routines to report various classes of problems. Each report is decorated
@@ -48,6 +48,7 @@ va_list ap;
/* tcpd_warn - report problem of some sort and proceed */
+/* PRINTFLIKE1 */
void tcpd_warn(char *format, ...)
{
va_list ap;
@@ -59,6 +60,7 @@ void tcpd_warn(char *format, ...)
/* tcpd_jump - report serious problem and jump */
+/* PRINTFLIKE1 */
void tcpd_jump(char *format, ...)
{
va_list ap;