Skip to content

Commit

Permalink
printf format string audit. from bill sommerfeld
Browse files Browse the repository at this point in the history
  • Loading branch information
itojun committed Oct 5, 2000
1 parent 93fbb3a commit c35fd41
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 46 deletions.
5 changes: 3 additions & 2 deletions kame/kame/faithd/faithd.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: faithd.c,v 1.30 2000/09/29 03:47:56 sakane Exp $ */
/* $KAME: faithd.c,v 1.31 2000/10/05 22:20:37 itojun Exp $ */

/*
* Copyright (C) 1997 and 1998 WIDE Project.
Expand Down Expand Up @@ -116,7 +116,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
Expand Down
8 changes: 5 additions & 3 deletions kame/kame/faithd/faithd.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: faithd.h,v 1.5 2000/07/28 07:34:27 itojun Exp $ */
/* $KAME: faithd.h,v 1.6 2000/10/05 22:20:37 itojun Exp $ */

/*
* Copyright (C) 1997 and 1998 WIDE Project.
Expand Down Expand Up @@ -38,8 +38,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/local/v6/libexec"
Expand Down
4 changes: 2 additions & 2 deletions kame/kame/pim6dd/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* Questions concerning this software should be directed to
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
*
* $Id: debug.c,v 1.8 2000/05/18 12:47:59 itojun Exp $
* $Id: debug.c,v 1.9 2000/10/05 22:20:38 itojun Exp $
*/
/*
* Part of this program has been derived from mrouted.
Expand Down Expand Up @@ -67,7 +67,7 @@ static char dumpfilename[] = _PATH_PIM6D_DUMP;
static char cachefilename[] = _PATH_PIM6D_CACHE; /* TODO: notused */

static char *sec2str __P((time_t));

static char *
sec2str(total)
time_t total;
Expand Down
5 changes: 3 additions & 2 deletions kame/kame/pim6dd/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Questions concerning this software should be directed to
* Kurt Windisch (kurtw@antc.uoregon.edu)
*
* $Id: defs.h,v 1.8 2000/07/20 10:09:59 itojun Exp $
* $Id: defs.h,v 1.9 2000/10/05 22:20:38 itojun Exp $
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
Expand Down Expand Up @@ -322,7 +322,8 @@ extern void config_vifs_from_file __P((void));
/* debug.c */
extern char *packet_kind __P((u_int proto, u_int type, u_int code));
extern int debug_kind __P((u_int proto, u_int type, u_int code));
extern void log __P((int, int, char *, ...));
extern void log __P((int, int, char *, ...))
__attribute__((__format__(__printf__, 3, 4)));
extern void dump_mldqueriers __P((FILE *));
extern int log_level __P((u_int proto, u_int type, u_int code));
extern void dump __P((int i));
Expand Down
4 changes: 2 additions & 2 deletions kame/kame/pim6dd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Questions concerning this software should be directed to
* Kurt Windisch (kurtw@antc.uoregon.edu)
*
* $Id: main.c,v 1.3 2000/03/26 19:11:41 sumikawa Exp $
* $Id: main.c,v 1.4 2000/10/05 22:20:38 itojun Exp $
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
Expand Down Expand Up @@ -657,7 +657,7 @@ restart(i)
int s;
#endif /* SNMP */

log(LOG_NOTICE, 0, "% restart", versionstring);
log(LOG_NOTICE, 0, "%s restart", versionstring);

/*
* reset all the entries
Expand Down
4 changes: 3 additions & 1 deletion kame/kame/pim6dd/mld6.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* Questions concerning this software should be directed to
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
*
* $Id: mld6.c,v 1.13 2000/04/12 07:34:38 jinmei Exp $
* $Id: mld6.c,v 1.14 2000/10/05 22:20:38 itojun Exp $
*/
/*
* Part of this program has been derived from mrouted.
Expand Down Expand Up @@ -341,6 +341,8 @@ int recvlen;
{
log(LOG_INFO, 0,
"RECV %s with an invalid scope: %s from %s",
packet_kind(IPPROTO_ICMPV6, mldh->mld6_type,
mldh->mld6_code),
inet6_fmt(&mldh->mld6_addr),
inet6_fmt(&src->sin6_addr));
return; /* discard */
Expand Down
10 changes: 5 additions & 5 deletions kame/kame/pim6dd/mld6_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Questions concerning this software should be directed to
* Kurt Windisch (kurtw@antc.uoregon.edu)
*
* $Id: mld6_proto.c,v 1.4 2000/05/05 12:38:30 jinmei Exp $
* $Id: mld6_proto.c,v 1.5 2000/10/05 22:20:38 itojun Exp $
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
Expand Down Expand Up @@ -226,7 +226,7 @@ accept_listener_query(src, dst, group, tmo)
IF_DEBUG(DEBUG_MLD)
log(LOG_DEBUG, 0,
"timer for grp %s on mif %d "
"set to %d",
"set to %ld",
inet6_fmt(group),
mifi, g->al_timer);
break;
Expand Down Expand Up @@ -267,7 +267,7 @@ accept_listener_report(src, dst, group)
IF_DEBUG(DEBUG_MLD)
log(LOG_INFO, 0,
"accepting multicast listener report: "
"src %s, dst% s, grp %s",
"src %s, dst %s, grp %s",
inet6_fmt(&src->sin6_addr), inet6_fmt(dst),
inet6_fmt(group));

Expand Down Expand Up @@ -339,7 +339,7 @@ accept_listener_done(src, dst, group)

IF_DEBUG(DEBUG_MLD)
log(LOG_INFO, 0,
"accepting listener done message: src %s, dst% s, grp %s",
"accepting listener done message: src %s, dst %s, grp %s",
inet6_fmt(&src->sin6_addr),
inet6_fmt(dst), inet6_fmt(group));

Expand All @@ -358,7 +358,7 @@ accept_listener_done(src, dst, group)
if (inet6_equal(&group_sa, &g->al_addr)) {
IF_DEBUG(DEBUG_MLD)
log(LOG_DEBUG, 0,
"[accept_done_message] %d %d \n",
"[accept_done_message] %d %ld\n",
g->al_old, g->al_query);

/*
Expand Down
4 changes: 2 additions & 2 deletions kame/kame/pim6dd/pim6_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* Questions concerning this software should be directed to
* Kurt Windisch (kurtw@antc.uoregon.edu)
*
* $Id: pim6_proto.c,v 1.5 2000/04/30 10:50:31 jinmei Exp $
* $Id: pim6_proto.c,v 1.6 2000/10/05 22:20:38 itojun Exp $
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
Expand Down Expand Up @@ -488,7 +488,7 @@ schedule_delayed_join(mrtentry_ptr, target)
#endif

IF_DEBUG(DEBUG_PIM_JOIN_PRUNE)
log(LOG_DEBUG, 0, "Scheduling join for src %s, grp %s, delay %d",
log(LOG_DEBUG, 0, "Scheduling join for src %s, grp %s, delay %ld",
inet6_fmt(&mrtentry_ptr->source->address.sin6_addr),
inet6_fmt(&mrtentry_ptr->group->group.sin6_addr),
random_delay);
Expand Down
4 changes: 2 additions & 2 deletions kame/kame/pim6dd/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Questions concerning this software should be directed to
* Kurt Windisch (kurtw@antc.uoregon.edu)
*
* $Id: timer.c,v 1.5 2000/05/18 16:09:39 itojun Exp $
* $Id: timer.c,v 1.6 2000/10/05 22:20:38 itojun Exp $
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
Expand Down Expand Up @@ -236,7 +236,7 @@ age_routes()
*/
IF_DEBUG(DEBUG_MFC)
log(LOG_DEBUG, 0,
"Refreshing src %s, dst %s after %d bytes forwarded",
"Refreshing src %s, dst %s after %ld bytes forwarded",
inet6_fmt(&mrtentry_ptr->source->address.sin6_addr),
inet6_fmt(&mrtentry_ptr->group->group.sin6_addr),
mrtentry_ptr->sg_count.bytecnt);
Expand Down
7 changes: 7 additions & 0 deletions kame/kame/pim6sd/cftoken.l
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ static void cfdebug_print __P((char *, char *, int));
#endif

extern int yylex __P((void));

static void yyerror0(char *s, va_list ap)
__attribute__((__format__(__printf__, 1, 0)));
void yyerror(char *s, ...)
__attribute__((__format__(__printf__, 1, 2)));
void yywarn(char *s, ...)
__attribute__((__format__(__printf__, 1, 2)));
%}

/* common seciton */
Expand Down
10 changes: 5 additions & 5 deletions kame/kame/route6d/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ CPPFLAGS+= -Dss_len=__ss_len -Dss_family=__ss_family -DADVAPI -DINET6 -DHAVE_GET
.else
CFLAGS+= -Dss_len=__ss_len -Dss_family=__ss_family -DADVAPI -DINET6 -DHAVE_GETIFADDRS
.endif
LDADD+= -L${.OBJDIR}/../libinet6 -L${.OBJDIR}/../libinet6/obj \
-L/usr/local/v6/lib -linet6
DPADD+= ${.OBJDIR}/../libinet6/libinet6.a \
${.OBJDIR}/../libinet6/obj/libinet6.a \
/usr/local/v6/lib/libinet6.a
#LDADD+= -L${.OBJDIR}/../libinet6 -L${.OBJDIR}/../libinet6/obj \
# -L/usr/local/v6/lib -linet6
#DPADD+= ${.OBJDIR}/../libinet6/libinet6.a \
# ${.OBJDIR}/../libinet6/obj/libinet6.a \
# /usr/local/v6/lib/libinet6.a

.include <bsd.prog.mk>
17 changes: 10 additions & 7 deletions kame/kame/route6d/route6d.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: route6d.c,v 1.35 2000/08/13 00:39:44 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.
Expand Down Expand Up @@ -30,7 +30,7 @@
*/

#ifndef lint
static char _rcsid[] = "$KAME: route6d.c,v 1.35 2000/08/13 00:39:44 itojun Exp $";
static char _rcsid[] = "$KAME: route6d.c,v 1.36 2000/10/05 22:20:39 itojun Exp $";
#endif

#include <stdio.h>
Expand Down Expand Up @@ -252,9 +252,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));
Expand Down Expand Up @@ -529,7 +532,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");

Expand Down Expand Up @@ -562,7 +565,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);
Expand Down
4 changes: 2 additions & 2 deletions kame/kame/rtsold/dump.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: dump.c,v 1.7 2000/08/13 06:14:59 itojun Exp $ */
/* $KAME: dump.c,v 1.8 2000/10/05 22:20:39 itojun Exp $ */

/*
* Copyright (C) 1999 WIDE Project.
Expand Down Expand Up @@ -98,7 +98,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;
}
Expand Down
11 changes: 6 additions & 5 deletions kame/kame/rtsold/rtsold.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: rtsold.c,v 1.26 2000/08/13 18:17:15 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.
Expand Down Expand Up @@ -251,7 +251,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);
Expand Down Expand Up @@ -551,8 +551,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);
}
Expand Down Expand Up @@ -703,7 +703,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);
}
Expand Down
9 changes: 3 additions & 6 deletions kame/kame/rtsold/rtsold.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: rtsold.h,v 1.9 2000/08/13 06:15:00 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.
Expand Down Expand Up @@ -63,11 +63,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));
Expand Down

0 comments on commit c35fd41

Please sign in to comment.