summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-18 03:44:07 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-18 03:44:07 +0000
commit1e7cda9b25e364fa644b87b78fe8f81b189a9493 (patch)
tree09462eb523569ee9d764a387e6a0acb9b14f403d
parentce05b867a48a0ab6a5bad5700ca7c6497dd7ac79 (diff)
format string audit. From: Gregory Steuck <greg@nest.cx>
-rw-r--r--usr.sbin/dhcp/common/print.c4
-rw-r--r--usr.sbin/dhcp/common/tree.c2
-rw-r--r--usr.sbin/dhcp/dhclient/clparse.c2
-rw-r--r--usr.sbin/dhcp/dhclient/dhclient.c6
-rw-r--r--usr.sbin/dhcp/includes/dhcpd.h10
-rw-r--r--usr.sbin/dhcp/relay/dhcrelay.c16
-rw-r--r--usr.sbin/dhcp/server/dhcp.c3
-rw-r--r--usr.sbin/dhcp/server/dhcpd.c26
8 files changed, 34 insertions, 35 deletions
diff --git a/usr.sbin/dhcp/common/print.c b/usr.sbin/dhcp/common/print.c
index 2b463c6dff2..4a80656ab47 100644
--- a/usr.sbin/dhcp/common/print.c
+++ b/usr.sbin/dhcp/common/print.c
@@ -118,7 +118,7 @@ void dump_packet (tp)
debug ("yiaddr = %s", inet_ntoa (tdp -> yiaddr));
debug ("siaddr = %s", inet_ntoa (tdp -> siaddr));
debug ("giaddr = %s", inet_ntoa (tdp -> giaddr));
- debug ("chaddr = %02.2x:%02.2x:%02.2x:%02.2x:%02.2x:%02.2x",
+ debug ("chaddr = %02x:%02x:%02x:%02x:%02x:%02x",
((unsigned char *)(tdp -> chaddr)) [0],
((unsigned char *)(tdp -> chaddr)) [1],
((unsigned char *)(tdp -> chaddr)) [2],
@@ -139,7 +139,7 @@ void dump_packet (tp)
tp -> options [i].len, 1, 1));
}
}
- debug ("");
+ debug ("%s", "");
}
void dump_raw (buf, len)
diff --git a/usr.sbin/dhcp/common/tree.c b/usr.sbin/dhcp/common/tree.c
index f86302c6ab1..53b46711ba3 100644
--- a/usr.sbin/dhcp/common/tree.c
+++ b/usr.sbin/dhcp/common/tree.c
@@ -270,7 +270,7 @@ static TIME tree_evaluate_recurse (bufix, bufp, bufcount, tree)
return t1;
default:
- warn ("Bad node id in tree: %d.");
+ warn ("Bad node id in tree: %d.", tree -> op);
t1 = MAX_TIME;
return t1;
}
diff --git a/usr.sbin/dhcp/dhclient/clparse.c b/usr.sbin/dhcp/dhclient/clparse.c
index 5f112c10872..bdce34d7814 100644
--- a/usr.sbin/dhcp/dhclient/clparse.c
+++ b/usr.sbin/dhcp/dhclient/clparse.c
@@ -383,7 +383,7 @@ int parse_option_list (cfile, list)
break;
}
if (i == 256) {
- parse_warn ("%s: expected option name.");
+ parse_warn ("%s: unexpected option name.", val);
skip_to_semi (cfile);
return 0;
}
diff --git a/usr.sbin/dhcp/dhclient/dhclient.c b/usr.sbin/dhcp/dhclient/dhclient.c
index 4ab63408cdb..4032192d763 100644
--- a/usr.sbin/dhcp/dhclient/dhclient.c
+++ b/usr.sbin/dhcp/dhclient/dhclient.c
@@ -307,10 +307,10 @@ static void usage (appname)
note("%s", message);
note("%s", copyright);
note("%s", arr);
- note("");
+ note("%s", "");
note("%s", contrib);
note("%s", url);
- note("");
+ note("%s", "");
warn("Usage: %s [-c1u] [-p <port>] [-lf lease-file]", appname);
error(" [-pf pidfile] [interface]");
@@ -1111,7 +1111,7 @@ void send_discover (ipp)
ip->client->packet.secs = htons (65535);
ip->client->secs = ip->client->packet.secs;
- note ("DHCPDISCOVER on %s to %s port %d interval %ld",
+ note ("DHCPDISCOVER on %s to %s port %d interval %d",
ip->name,
inet_ntoa (sockaddr_broadcast.sin_addr),
ntohs (sockaddr_broadcast.sin_port), ip->client->interval);
diff --git a/usr.sbin/dhcp/includes/dhcpd.h b/usr.sbin/dhcp/includes/dhcpd.h
index 25396eb29c9..808893647f8 100644
--- a/usr.sbin/dhcp/includes/dhcpd.h
+++ b/usr.sbin/dhcp/includes/dhcpd.h
@@ -494,11 +494,11 @@ void do_packet PROTO ((struct interface_info *,
/* errwarn.c */
extern int warnings_occurred;
-void error PROTO ((char *, ...));
-int warn PROTO ((char *, ...));
-int note PROTO ((char *, ...));
-int debug PROTO ((char *, ...));
-int parse_warn PROTO ((char *, ...));
+void error (char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
+int warn (char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
+int note (char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
+int debug (char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
+int parse_warn (char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
/* dhcpd.c */
extern TIME cur_time;
diff --git a/usr.sbin/dhcp/relay/dhcrelay.c b/usr.sbin/dhcp/relay/dhcrelay.c
index 876b7e7bd18..e549395de2e 100644
--- a/usr.sbin/dhcp/relay/dhcrelay.c
+++ b/usr.sbin/dhcp/relay/dhcrelay.c
@@ -159,12 +159,12 @@ int main (argc, argv, envp)
if (!quiet) {
note ("%s %s", message, DHCP_VERSION);
- note (copyright);
- note (arr);
- note ("");
- note (contrib);
- note (url);
- note ("");
+ note ("%s", copyright);
+ note ("%s", arr);
+ note ("%s", "");
+ note ("%s", contrib);
+ note ("%s", url);
+ note ("%s", "");
} else
log_perror = 0;
@@ -344,10 +344,10 @@ static void usage (appname)
note (message);
note (copyright);
note (arr);
- note ("");
+ note ("%s", "");
note (contrib);
note (url);
- note ("");
+ note ("%s", "");
warn ("Usage: %s [-i] [-d] [-i if0] [...-i ifN] [-p <port>]", appname);
error (" [-pf pidfilename] [server1 [... serverN]]");
diff --git a/usr.sbin/dhcp/server/dhcp.c b/usr.sbin/dhcp/server/dhcp.c
index dd87756df9a..487065230ed 100644
--- a/usr.sbin/dhcp/server/dhcp.c
+++ b/usr.sbin/dhcp/server/dhcp.c
@@ -422,8 +422,7 @@ void dhcprelease (packet)
packet -> raw -> chaddr),
packet -> raw -> giaddr.s_addr
? inet_ntoa (packet -> raw -> giaddr)
- : packet -> interface -> name,
- lease ? "" : "not ");
+ : packet -> interface -> name);
lease->releasing = 1;
add_timeout (cur_time + 1, lease_ping_timeout, lease);
diff --git a/usr.sbin/dhcp/server/dhcpd.c b/usr.sbin/dhcp/server/dhcpd.c
index 01290ce9f8d..1a7582ed528 100644
--- a/usr.sbin/dhcp/server/dhcpd.c
+++ b/usr.sbin/dhcp/server/dhcpd.c
@@ -164,12 +164,12 @@ int main (argc, argv, envp)
if (!quiet) {
note ("%s %s", message, DHCP_VERSION);
- note (copyright);
- note (arr);
- note ("");
- note (contrib);
- note (url);
- note ("");
+ note ("%s", copyright);
+ note ("%s", arr);
+ note ("%s", "");
+ note ("%s", contrib);
+ note ("%s", url);
+ note ("%s", "");
} else
log_perror = 0;
@@ -287,13 +287,13 @@ int main (argc, argv, envp)
static void usage (appname)
char *appname;
{
- note (message);
- note (copyright);
- note (arr);
- note ("");
- note (contrib);
- note (url);
- note ("");
+ note ("%s", message);
+ note ("%s", copyright);
+ note ("%s", arr);
+ note ("%s", "");
+ note ("%s", contrib);
+ note ("%s", url);
+ note ("%s", "");
warn ("Usage: %s [-p <UDP port #>] [-d] [-f] [-cf config-file]",
appname);