summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-10-06 02:47:00 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-10-06 02:47:00 +0000
commit8e04df6d18059de21c91270ddc9ad6d904cffea4 (patch)
tree60ebc90177a4171cf037943ee0cd3cf5f774b0a4
parent37567b7c3cb65f88a9ffbeee7e3ab97241fd2b4c (diff)
printf string format audit. from: sommerfeld@netbsd.org
-rw-r--r--usr.sbin/faithd/faithd.c11
-rw-r--r--usr.sbin/faithd/faithd.h10
-rw-r--r--usr.sbin/faithd/tcp.c7
-rw-r--r--usr.sbin/route6d/route6d.88
-rw-r--r--usr.sbin/route6d/route6d.c19
-rw-r--r--usr.sbin/rtsold/dump.c6
-rw-r--r--usr.sbin/rtsold/rtsold.c13
-rw-r--r--usr.sbin/rtsold/rtsold.h11
8 files changed, 45 insertions, 40 deletions
diff --git a/usr.sbin/faithd/faithd.c b/usr.sbin/faithd/faithd.c
index b5673d3e8e3..bab7391eaae 100644
--- a/usr.sbin/faithd/faithd.c
+++ b/usr.sbin/faithd/faithd.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: faithd.c,v 1.8 2000/09/16 10:33:45 itojun Exp $ */
-/* $KAME: faithd.c,v 1.29 2000/09/12 05:20:35 itojun Exp $ */
+/* $OpenBSD: faithd.c,v 1.9 2000/10/06 02:46:58 itojun Exp $ */
+/* $KAME: faithd.c,v 1.31 2000/10/05 22:20:37 itojun Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@@ -119,7 +119,8 @@ static int map4to6 __P((struct sockaddr_in *, struct sockaddr_in6 *));
static void sig_child __P((int));
static void sig_terminate __P((int));
static void start_daemon __P((void));
-static void exit_stderr __P((const char *, ...));
+static void exit_stderr __P((const char *, ...))
+ __attribute__((__format__(__printf__, 1, 2)));
#ifndef HAVE_GETIFADDRS
static unsigned int if_maxindex __P((void));
#endif
@@ -183,10 +184,10 @@ inetd_main(int argc, char **argv)
melen = sizeof(me);
if (getsockname(STDIN_FILENO, (struct sockaddr *)&me, &melen) < 0)
- exit_failure("getsockname");
+ exit_failure("getsockname: %s", ERRSTR);
fromlen = sizeof(from);
if (getpeername(STDIN_FILENO, (struct sockaddr *)&from, &fromlen) < 0)
- exit_failure("getpeername");
+ exit_failure("getpeername: %s", ERRSTR);
if (getnameinfo((struct sockaddr *)&me, melen, NULL, 0,
sbuf, sizeof(sbuf), NI_NUMERICHOST) == 0)
service = sbuf;
diff --git a/usr.sbin/faithd/faithd.h b/usr.sbin/faithd/faithd.h
index 954a1600d74..1da3bf3cbc4 100644
--- a/usr.sbin/faithd/faithd.h
+++ b/usr.sbin/faithd/faithd.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: faithd.h,v 1.4 2000/09/16 10:33:45 itojun Exp $ */
-/* $KAME: faithd.h,v 1.5 2000/07/28 07:34:27 itojun Exp $ */
+/* $OpenBSD: faithd.h,v 1.5 2000/10/06 02:46:59 itojun Exp $ */
+/* $KAME: faithd.h,v 1.6 2000/10/05 22:20:37 itojun Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@@ -39,8 +39,10 @@ extern int ftp_active __P((int, int, int *, int *));
extern int ftp_passive __P((int, int, int *, int *));
extern void rsh_relay __P((int, int));
extern void rsh_dual_relay __P((int, int));
-extern void exit_success __P((const char *, ...));
-extern void exit_failure __P((const char *, ...));
+extern void exit_success __P((const char *, ...))
+ __attribute__((__format__(__printf__, 1, 2)));
+extern void exit_failure __P((const char *, ...))
+ __attribute__((__format__(__printf__, 1, 2)));
#define DEFAULT_PORT_NAME "telnet"
#define DEFAULT_DIR "/usr/libexec"
diff --git a/usr.sbin/faithd/tcp.c b/usr.sbin/faithd/tcp.c
index 343ae238cfc..1c660cf2ab6 100644
--- a/usr.sbin/faithd/tcp.c
+++ b/usr.sbin/faithd/tcp.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: tcp.c,v 1.4 2000/09/16 10:33:46 itojun Exp $ */
-/* $KAME: tcp.c,v 1.4 2000/07/28 08:05:00 itojun Exp $ */
+/* $OpenBSD: tcp.c,v 1.5 2000/10/06 02:46:59 itojun Exp $ */
+/* $KAME: tcp.c,v 1.5 2000/09/29 03:48:31 sakane Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@@ -194,7 +194,8 @@ relay(int s_rcv, int s_snd, const char *service, int direction)
FD_ZERO(&exceptfds);
fcntl(s_snd, F_SETFD, O_NONBLOCK);
oreadfds = readfds; owritefds = writefds; oexceptfds = exceptfds;
- FD_SET(s_rcv, &readfds); FD_SET(s_rcv, &exceptfds);
+ FD_SET(s_rcv, &readfds);
+ FD_SET(s_rcv, &exceptfds);
oob_exists = 0;
maxfd = (s_rcv > s_snd) ? s_rcv : s_snd;
diff --git a/usr.sbin/route6d/route6d.8 b/usr.sbin/route6d/route6d.8
index f06d9d3ed24..27a3057a719 100644
--- a/usr.sbin/route6d/route6d.8
+++ b/usr.sbin/route6d/route6d.8
@@ -1,5 +1,5 @@
-.\" $OpenBSD: route6d.8,v 1.9 2000/07/15 04:59:29 itojun Exp $
-.\" $KAME: route6d.8,v 1.8 2000/05/31 17:00:09 itojun Exp $
+.\" $OpenBSD: route6d.8,v 1.10 2000/10/06 02:46:58 itojun Exp $
+.\" $KAME: route6d.8,v 1.9 2000/07/24 12:39:46 itojun Exp $
.\"
.\" Copyright (c) 1996 WIDE Project. All rights reserved.
.\"
@@ -58,7 +58,7 @@ Enables aging of the statically defined routes.
With this option, any
statically defined routes will be removed unless corresponding updates
arrive as if the routes are received at the startup of
-.Nm route6d .
+.Nm Ns .
.\"
.It Fl R Ar routelog
This option makes the
@@ -221,7 +221,7 @@ or
.Re
.\"
.Sh NOTE
-.Nm Route6d
+.Nm
uses IPv6 advanced API,
defined in RFC2292,
for communicating with peers using link-local addresses.
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index c3621859127..54d2a2f4d64 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: route6d.c,v 1.9 2000/08/13 00:48:39 itojun Exp $ */
-/* $KAME: route6d.c,v 1.35 2000/08/13 00:39:44 itojun Exp $ */
+/* $OpenBSD: route6d.c,v 1.10 2000/10/06 02:46:58 itojun Exp $ */
+/* $KAME: route6d.c,v 1.36 2000/10/05 22:20:39 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -31,7 +31,7 @@
*/
#if 0
-static char _rcsid[] = "$OpenBSD: route6d.c,v 1.9 2000/08/13 00:48:39 itojun Exp $";
+static char _rcsid[] = "$OpenBSD: route6d.c,v 1.10 2000/10/06 02:46:58 itojun Exp $";
#endif
#include <stdio.h>
@@ -253,9 +253,12 @@ struct in6_addr *plen2mask __P((int));
struct riprt *rtsearch __P((struct netinfo6 *));
int ripinterval __P((int));
time_t ripsuptrig __P((void));
-void fatal __P((const char *, ...));
-void trace __P((int, const char *, ...));
-void tracet __P((int, const char *, ...));
+void fatal __P((const char *, ...))
+ __attribute__((__format__(__printf__, 1, 2)));
+void trace __P((int, const char *, ...))
+ __attribute__((__format__(__printf__, 2, 3)));
+void tracet __P((int, const char *, ...))
+ __attribute__((__format__(__printf__, 2, 3)));
unsigned int if_maxindex __P((void));
struct ifc *ifc_find __P((char *));
struct iff *iff_find __P((struct ifc *, int));
@@ -530,7 +533,7 @@ init()
hints.ai_flags = AI_PASSIVE;
error = getaddrinfo(NULL, port, &hints, &res);
if (error)
- fatal(gai_strerror(error));
+ fatal("%s", gai_strerror(error));
if (res->ai_next)
fatal(":: resolved to multiple address");
@@ -563,7 +566,7 @@ init()
hints.ai_socktype = SOCK_DGRAM;
error = getaddrinfo(RIP6_DEST, port, &hints, &res);
if (error)
- fatal(gai_strerror(error));
+ fatal("%s", gai_strerror(error));
if (res->ai_next)
fatal("%s resolved to multiple address", RIP6_DEST);
memcpy(&ripsin, res->ai_addr, res->ai_addrlen);
diff --git a/usr.sbin/rtsold/dump.c b/usr.sbin/rtsold/dump.c
index 5df4ecd32be..ddbb0ec441a 100644
--- a/usr.sbin/rtsold/dump.c
+++ b/usr.sbin/rtsold/dump.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: dump.c,v 1.4 2000/08/13 18:24:00 itojun Exp $ */
-/* $KAME: dump.c,v 1.7 2000/08/13 06:14:59 itojun Exp $ */
+/* $OpenBSD: dump.c,v 1.5 2000/10/06 02:46:58 itojun Exp $ */
+/* $KAME: dump.c,v 1.8 2000/10/05 22:20:39 itojun Exp $ */
/*
* Copyright (C) 1999 WIDE Project.
@@ -99,7 +99,7 @@ rtsold_dump_file(dumpfile)
char *dumpfile;
{
if ((fp = fopen(dumpfile, "w")) == NULL) {
- warnmsg(LOG_WARNING, __FUNCTION__, "open a dump file(%s)",
+ warnmsg(LOG_WARNING, __FUNCTION__, "open a dump file(%s): %s",
dumpfile, strerror(errno));
return;
}
diff --git a/usr.sbin/rtsold/rtsold.c b/usr.sbin/rtsold/rtsold.c
index c6eec0d5020..93caf2a3486 100644
--- a/usr.sbin/rtsold/rtsold.c
+++ b/usr.sbin/rtsold/rtsold.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: rtsold.c,v 1.8 2000/08/13 18:24:00 itojun Exp $ */
-/* $KAME: rtsold.c,v 1.26 2000/08/13 18:17:15 itojun Exp $ */
+/* $OpenBSD: rtsold.c,v 1.9 2000/10/06 02:46:58 itojun Exp $ */
+/* $KAME: rtsold.c,v 1.27 2000/10/05 22:20:39 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -252,7 +252,7 @@ main(argc, argv)
if ((fp = fopen(pidfilename, "w")) == NULL)
warnmsg(LOG_ERR, __FUNCTION__,
- "failed to open a log file(%s)",
+ "failed to open a log file(%s): %s",
pidfilename, strerror(errno));
else {
fprintf(fp, "%d\n", pid);
@@ -552,8 +552,8 @@ rtsol_check_timer()
TIMEVAL_SUB(&rtsol_timer, &now, &returnval);
if (dflag > 1)
- warnmsg(LOG_DEBUG, __FUNCTION__, "New timer is %d:%08d",
- returnval.tv_sec, returnval.tv_usec);
+ warnmsg(LOG_DEBUG, __FUNCTION__, "New timer is %ld:%08ld",
+ (long)returnval.tv_sec, (long)returnval.tv_usec);
return(&returnval);
}
@@ -704,7 +704,8 @@ warnmsg(priority, func, msg, va_alist)
}
} else {
snprintf(buf, sizeof(buf), "<%s> %s", func, msg);
- vsyslog(priority, buf, ap);
+ msg = buf;
+ vsyslog(priority, msg, ap);
}
va_end(ap);
}
diff --git a/usr.sbin/rtsold/rtsold.h b/usr.sbin/rtsold/rtsold.h
index 41a6efd2595..8bb266878c1 100644
--- a/usr.sbin/rtsold/rtsold.h
+++ b/usr.sbin/rtsold/rtsold.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: rtsold.h,v 1.4 2000/08/13 18:24:00 itojun Exp $ */
-/* $KAME: rtsold.h,v 1.9 2000/08/13 06:15:00 itojun Exp $ */
+/* $OpenBSD: rtsold.h,v 1.5 2000/10/06 02:46:58 itojun Exp $ */
+/* $KAME: rtsold.h,v 1.10 2000/10/05 22:20:39 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -64,11 +64,8 @@ extern struct timeval tm_max;
extern int dflag;
struct ifinfo *find_ifinfo __P((int ifindex));
void rtsol_timer_update __P((struct ifinfo *ifinfo));
-#ifdef __STDC__
-extern void warnmsg __P((int, const char *, const char *, ...));
-#else
-extern void warnmsg __P((int, const char *, const char *, va_list));
-#endif
+extern void warnmsg __P((int, const char *, const char *, ...))
+ __attribute__((__format__(__printf__, 3, 4)));
/* if.c */
extern int ifinit __P((void));