summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2003-04-04 02:21:27 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2003-04-04 02:21:27 +0000
commit8612bd7aa029e97b21cb74b0c89c774dc52d7dc4 (patch)
treeae24459b6a02873da9c7ea031cf60e4cc01af297 /sys
parent7131897840ff1790e9a998b300dc54971bdd2d3b (diff)
sprintf -> snprintf, plus check for overflow in device name.
ok deraadt@ millert@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ccd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index e87d6a7f30a..f8df7bfb512 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ccd.c,v 1.51 2003/03/28 02:39:07 millert Exp $ */
+/* $OpenBSD: ccd.c,v 1.52 2003/04/04 02:21:26 krw Exp $ */
/* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */
/*-
@@ -289,7 +289,11 @@ ccdinit(ccd, cpaths, p)
cs->sc_size = 0;
cs->sc_ileave = ccd->ccd_interleave;
cs->sc_nccdisks = ccd->ccd_ndev;
- sprintf(cs->sc_xname, "ccd%d", ccd->ccd_unit); /* XXX */
+ if (snprintf(cs->sc_xname, sizeof(cs->sc_xname), "ccd%d",
+ ccd->ccd_unit) >= sizeof(cs->sc_xname)) {
+ printf("ccdinit: device name too long.\n");
+ return(ENXIO);
+ }
/* Allocate space for the component info. */
cs->sc_cinfo = malloc(cs->sc_nccdisks * sizeof(struct ccdcinfo),