summaryrefslogtreecommitdiffstats
path: root/sys/alpha/tc
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>1998-12-04 22:54:57 +0000
committerarchie <archie@FreeBSD.org>1998-12-04 22:54:57 +0000
commit982e80577dd08945aa2345ebe35e3f50eef9eb48 (patch)
treee21ff4cbfbcb4097c6cc444d68ddd9a3fd37837f /sys/alpha/tc
parent707b8f68aa118c7396f2a2633751e32477d9ed08 (diff)
downloadFreeBSD-src-982e80577dd08945aa2345ebe35e3f50eef9eb48.zip
FreeBSD-src-982e80577dd08945aa2345ebe35e3f50eef9eb48.tar.gz
Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s with snprintf(); for others cases, added terminating NUL bytes where appropriate, replaced constants like "16" with sizeof(), etc. These changes include several bug fixes, but most changes are for maintainability's sake. Any instance where it wasn't "immediately obvious" that a buffer overflow could not occur was made safer. Reviewed by: Bruce Evans <bde@zeta.org.au> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Reviewed by: Mike Spengler <mks@networkcs.com>
Diffstat (limited to 'sys/alpha/tc')
-rw-r--r--sys/alpha/tc/am7990.c5
-rw-r--r--sys/alpha/tc/espvar.h5
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/alpha/tc/am7990.c b/sys/alpha/tc/am7990.c
index 6c65f82..d734c15 100644
--- a/sys/alpha/tc/am7990.c
+++ b/sys/alpha/tc/am7990.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: am7990.c,v 1.1 1998/08/20 08:27:10 dfr Exp $ */
/* $NetBSD: am7990.c,v 1.43 1998/03/29 22:36:42 mycroft Exp $ */
/*-
@@ -194,7 +194,8 @@ am7990_config(sc)
/* Make sure the chip is stopped. */
am7990_stop(sc);
/* Initialize ifnet structure. */
- sprintf(sc->sc_dev.dv_xname, "le%d", sc->unit);
+ snprintf(sc->sc_dev.dv_xname,
+ sizeof(sc->sc_dev.dv_xname), "le%d", sc->unit);
ifp->if_unit = sc->unit;
ifp->if_name = "le";
ifp->if_softc = sc;
diff --git a/sys/alpha/tc/espvar.h b/sys/alpha/tc/espvar.h
index ad5d139..b64b774 100644
--- a/sys/alpha/tc/espvar.h
+++ b/sys/alpha/tc/espvar.h
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: espvar.h,v 1.1 1998/08/20 08:27:10 dfr Exp $ */
/* $NetBSD: espvar.h,v 1.3.4.1 1996/09/10 17:28:18 cgd Exp $ */
/*
@@ -74,8 +74,7 @@ struct ecb {
#define ECB_TRACE(ecb, msg, a, b) do { \
const char *f = "[" msg "]"; \
int n = strlen((ecb)->trace); \
- if (n < (sizeof((ecb)->trace)-100)) \
- sprintf((ecb)->trace + n, f, a, b); \
+ snprintf((ecb)->trace + n, sizeof((ecb)->trace) - n, f, a, b); \
} while(0)
#else
#define ECB_TRACE(ecb, msg, a, b)
OpenPOWER on IntegriCloud