summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-02-15 03:31:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-02-15 03:31:17 +0000
commitd45fbbf3638085cb11917065d8c97e211271ba48 (patch)
tree29021d6a1f6e916f613ecb3c59d5aeec96ed8175
parenta66a53958fc5d5e5b6d0d16ec3357062875ee0bb (diff)
bit of strcpy and sprintf culling
-rw-r--r--usr.sbin/altq/libaltq/parser.c6
-rw-r--r--usr.sbin/altq/tbrconfig/tbrconfig.c19
2 files changed, 13 insertions, 12 deletions
diff --git a/usr.sbin/altq/libaltq/parser.c b/usr.sbin/altq/libaltq/parser.c
index 22d1e2cdeae..6fe970143b9 100644
--- a/usr.sbin/altq/libaltq/parser.c
+++ b/usr.sbin/altq/libaltq/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.5 2002/02/13 08:21:45 kjc Exp $ */
+/* $OpenBSD: parser.c,v 1.6 2002/02/15 03:31:15 deraadt Exp $ */
/* $KAME: parser.c,v 1.13 2002/02/12 10:14:01 kjc Exp $ */
/*
* Copyright (C) 1999-2002
@@ -467,12 +467,12 @@ interface_parser(char *cmdbuf)
}
/* create argment list & look for scheduling discipline options. */
- sprintf(qdisc_name, "null");
+ snprintf(qdisc_name, sizeof qdisc_name, "null");
argc = 0;
ap = w;
while (next_word(&cp, ap)) {
if (is_qdisc_name(ap))
- strcpy(qdisc_name, ap);
+ strlcpy(qdisc_name, ap, sizeof qdisc_name);
argv[argc] = ap;
ap += strlen(ap) + 1;
diff --git a/usr.sbin/altq/tbrconfig/tbrconfig.c b/usr.sbin/altq/tbrconfig/tbrconfig.c
index c8a6f06f400..c6a98ea27ec 100644
--- a/usr.sbin/altq/tbrconfig/tbrconfig.c
+++ b/usr.sbin/altq/tbrconfig/tbrconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tbrconfig.c,v 1.2 2001/10/26 07:39:52 kjc Exp $ */
+/* $OpenBSD: tbrconfig.c,v 1.3 2002/02/15 03:31:16 deraadt Exp $ */
/* $KAME: tbrconfig.c,v 1.3 2001/05/08 04:36:39 itojun Exp $ */
/*
* Copyright (C) 2000
@@ -138,15 +138,15 @@ main(int argc, char **argv)
char rate_str[64], size_str[64];
if (req.tb_prof.rate < 999999)
- sprintf(rate_str, "%.2fK",
+ snprintf(rate_str, sizeof rate_str, "%.2fK",
(double)req.tb_prof.rate/1000.0);
else
- sprintf(rate_str, "%.2fM",
+ snprintf(rate_str, sizeof rate_str, "%.2fM",
(double)req.tb_prof.rate/1000000.0);
if (req.tb_prof.depth < 10240)
- sprintf(size_str, "%u", req.tb_prof.depth);
+ snprintf(size_str, sizeof size_str, "%u", req.tb_prof.depth);
else
- sprintf(size_str, "%.2fK",
+ snprintf(size_str, sizeof size_str, "%.2fK",
(double)req.tb_prof.depth/1024.0);
printf("%s: tokenrate %s(bps) bucketsize %s(bytes)\n",
req.ifname, rate_str, size_str);
@@ -179,15 +179,16 @@ list_all(void)
continue;
if (req.tb_prof.rate < 999999)
- sprintf(rate_str, "%.2fK",
+ snprintf(rate_str, sizeof rate_str, "%.2fK",
(double)req.tb_prof.rate/1000.0);
else
- sprintf(rate_str, "%.2fM",
+ snprintf(rate_str, sizeof rate_str, "%.2fM",
(double)req.tb_prof.rate/1000000.0);
if (req.tb_prof.depth < 10240)
- sprintf(size_str, "%u", req.tb_prof.depth);
+ snprintf(size_str, sizeof size_str,
+ "%u", req.tb_prof.depth);
else
- sprintf(size_str, "%.2fK",
+ snprintf(size_str, sizeof size_str, "%.2fK",
(double)req.tb_prof.depth/1024.0);
printf("%s: tokenrate %s(bps) bucketsize %s(bytes)\n",
req.ifname, rate_str, size_str);