diff options
| author | itojun <itojun@NetBSD.org> | 2004-04-22 00:17:10 +0000 |
|---|---|---|
| committer | itojun <itojun@NetBSD.org> | 2004-04-22 00:17:10 +0000 |
| commit | aca4c091d32e5d41fde26cf072df6355ec7fa79b (patch) | |
| tree | 498f57df69e0a3d0b702d3aa166ed352fe32e53f /sys/dev/ic | |
| parent | fd2a977729985cfb18c9fefeca871d3649724943 (diff) | |
sprintf -> snprintf
Diffstat (limited to 'sys/dev/ic')
| -rw-r--r-- | sys/dev/ic/bha.c | 10 | ||||
| -rw-r--r-- | sys/dev/ic/cs4231.c | 7 | ||||
| -rw-r--r-- | sys/dev/ic/daic.c | 10 | ||||
| -rw-r--r-- | sys/dev/ic/dpt.c | 7 | ||||
| -rw-r--r-- | sys/dev/ic/hd64570.c | 6 | ||||
| -rw-r--r-- | sys/dev/ic/interwave.c | 7 | ||||
| -rw-r--r-- | sys/dev/ic/midway.c | 30 | ||||
| -rw-r--r-- | sys/dev/ic/mlx.c | 10 | ||||
| -rw-r--r-- | sys/dev/ic/nslm7x.c | 34 | ||||
| -rw-r--r-- | sys/dev/ic/opl.c | 7 | ||||
| -rw-r--r-- | sys/dev/ic/rrunner.c | 22 | ||||
| -rw-r--r-- | sys/dev/ic/sl811hs.c | 7 | ||||
| -rw-r--r-- | sys/dev/ic/tms320av110.c | 11 |
13 files changed, 92 insertions, 76 deletions
diff --git a/sys/dev/ic/bha.c b/sys/dev/ic/bha.c index 00267ff205d..388ca744fed 100644 --- a/sys/dev/ic/bha.c +++ b/sys/dev/ic/bha.c @@ -1,4 +1,4 @@ -/* $NetBSD: bha.c,v 1.57 2003/11/02 11:07:45 wiz Exp $ */ +/* $NetBSD: bha.c,v 1.58 2004/04/22 00:17:11 itojun Exp $ */ /*- * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. @@ -53,7 +53,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bha.c,v 1.57 2003/11/02 11:07:45 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bha.c,v 1.58 2004/04/22 00:17:11 itojun Exp $"); #include "opt_ddb.h" @@ -1199,15 +1199,15 @@ bha_info(sc) */ if (inquire.reply.bus_type == BHA_BUS_TYPE_24BIT && sc->sc_firmware[0] < '3') - sprintf(sc->sc_model, "542B"); + snprintf(sc->sc_model, sizeof(sc->sc_model), "542B"); else if (inquire.reply.bus_type == BHA_BUS_TYPE_32BIT && sc->sc_firmware[0] == '2' && (sc->sc_firmware[2] == '1' || (sc->sc_firmware[2] == '2' && sc->sc_firmware[3] == '0'))) - sprintf(sc->sc_model, "742A"); + snprintf(sc->sc_model, sizeof(sc->sc_model), "742A"); else if (inquire.reply.bus_type == BHA_BUS_TYPE_32BIT && sc->sc_firmware[0] == '0') - sprintf(sc->sc_model, "747A"); + snprintf(sc->sc_model, sizeof(sc->sc_model), "747A"); else { p = sc->sc_model; model.cmd.opcode = BHA_INQUIRE_MODEL; diff --git a/sys/dev/ic/cs4231.c b/sys/dev/ic/cs4231.c index b978c2226a6..49417a6eefc 100644 --- a/sys/dev/ic/cs4231.c +++ b/sys/dev/ic/cs4231.c @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231.c,v 1.13 2003/09/10 11:53:53 uwe Exp $ */ +/* $NetBSD: cs4231.c,v 1.14 2004/04/22 00:17:11 itojun Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cs4231.c,v 1.13 2003/09/10 11:53:53 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs4231.c,v 1.14 2004/04/22 00:17:11 itojun Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -171,7 +171,8 @@ cs4231_common_attach(sc, ioh) break; default: if ((buf = malloc(32, M_TEMP, M_NOWAIT)) != NULL) { - sprintf(buf, "unknown rev: %x/%x", reg&0xe0, reg&7); + snprintf(buf, 32, "unknown rev: %x/%x", + reg&0xe0, reg&7); sc->sc_ad1848.chip_name = buf; } } diff --git a/sys/dev/ic/daic.c b/sys/dev/ic/daic.c index 8406410b68e..b8616fbb599 100644 --- a/sys/dev/ic/daic.c +++ b/sys/dev/ic/daic.c @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: daic.c,v 1.18 2004/02/24 15:22:01 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: daic.c,v 1.19 2004/04/22 00:17:11 itojun Exp $"); /* * daic.c: MI driver for Diehl active ISDN cards (S, SX, SXn, SCOM, QUADRO) @@ -696,10 +696,12 @@ daic_register_port(struct daic_softc *sc, int port) /* make sure this hardware driver type is known to layer 4 */ if (sc->sc_cardtype == DAIC_TYPE_QUAD) - sprintf(devname, "%s port %d", sc->sc_dev.dv_xname, port); + snprintf(devname, sizeof(devname), "%s port %d", + sc->sc_dev.dv_xname, port); else - strcpy(devname, sc->sc_dev.dv_xname); - sprintf(cardname, "EICON.Diehl %s", cardtypename(sc->sc_cardtype)); + strlcpy(devname, sc->sc_dev.dv_xname, sizeof(devname)); + snprintf(cardname, sizeof(cardname), "EICON.Diehl %s", + cardtypename(sc->sc_cardtype)); l3drv = isdn_attach_isdnif( devname, cardname, &sc->sc_port[port], &daic_l3_functions, 2); sc->sc_port[port].du_l3 = l3drv; diff --git a/sys/dev/ic/dpt.c b/sys/dev/ic/dpt.c index 047d14d19cd..fde77e18a33 100644 --- a/sys/dev/ic/dpt.c +++ b/sys/dev/ic/dpt.c @@ -1,4 +1,4 @@ -/* $NetBSD: dpt.c,v 1.42 2003/10/25 18:35:42 christos Exp $ */ +/* $NetBSD: dpt.c,v 1.43 2004/04/22 00:17:11 itojun Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.42 2003/10/25 18:35:42 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.43 2004/04/22 00:17:11 itojun Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -333,7 +333,8 @@ dpt_init(struct dpt_softc *sc, const char *intrstr) char model[16]; ec = &sc->sc_ec; - sprintf(dpt_sig.dsDescription, "NetBSD %s DPT driver", osrelease); + snprintf(dpt_sig.dsDescription, sizeof(dpt_sig.dsDescription), + "NetBSD %s DPT driver", osrelease); /* * Allocate the CCB/status packet/scratch DMA map and load. diff --git a/sys/dev/ic/hd64570.c b/sys/dev/ic/hd64570.c index 46fd8085f3a..971a5761d18 100644 --- a/sys/dev/ic/hd64570.c +++ b/sys/dev/ic/hd64570.c @@ -1,4 +1,4 @@ -/* $NetBSD: hd64570.c,v 1.26 2004/02/24 15:05:54 wiz Exp $ */ +/* $NetBSD: hd64570.c,v 1.27 2004/04/22 00:17:11 itojun Exp $ */ /* * Copyright (c) 1999 Christian E. Hopps @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hd64570.c,v 1.26 2004/02/24 15:05:54 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hd64570.c,v 1.27 2004/04/22 00:17:11 itojun Exp $"); #include "bpfilter.h" #include "opt_inet.h" @@ -444,7 +444,7 @@ sca_port_attach(struct sca_softc *sc, u_int port) * attach to the network layer */ ifp = &scp->sp_if; - sprintf(ifp->if_xname, "ntwo%d", ntwo_unit); + snprintf(ifp->if_xname, sizeof(ifp->if_xname), "ntwo%d", ntwo_unit); ifp->if_softc = scp; ifp->if_mtu = SCA_MTU; ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; diff --git a/sys/dev/ic/interwave.c b/sys/dev/ic/interwave.c index c1e6b1c56c7..59e47c3b4b6 100644 --- a/sys/dev/ic/interwave.c +++ b/sys/dev/ic/interwave.c @@ -1,4 +1,4 @@ -/* $NetBSD: interwave.c,v 1.19 2003/10/30 01:58:17 simonb Exp $ */ +/* $NetBSD: interwave.c,v 1.20 2004/04/22 00:17:11 itojun Exp $ */ /* * Copyright (c) 1997, 1999 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: interwave.c,v 1.19 2003/10/30 01:58:17 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interwave.c,v 1.20 2004/04/22 00:17:11 itojun Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -486,7 +486,8 @@ iwreset(sc, warm) sc->vers = reg >> 4; if (!warm) - sprintf(iw_device.version, "%d.%d", sc->vers, sc->revision); + snprintf(iw_device.version, sizeof(iw_device.version), "%d.%d", + sc->vers, sc->revision); IW_WRITE_GENERAL_1(IDECI, 0x7f); /* irqs and codec decode * enable */ diff --git a/sys/dev/ic/midway.c b/sys/dev/ic/midway.c index 3c61bc3763e..bd730c67e3f 100644 --- a/sys/dev/ic/midway.c +++ b/sys/dev/ic/midway.c @@ -1,4 +1,4 @@ -/* $NetBSD: midway.c,v 1.63 2003/11/02 11:07:45 wiz Exp $ */ +/* $NetBSD: midway.c,v 1.64 2004/04/22 00:17:11 itojun Exp $ */ /* (sync'd to midway.c 1.68) */ /* @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.63 2003/11/02 11:07:45 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.64 2004/04/22 00:17:11 itojun Exp $"); #include "opt_natm.h" @@ -1293,9 +1293,10 @@ caddr_t data; case SIOCGPVCSIF: if (ifp != &sc->enif) { #ifdef __NetBSD__ - strcpy(ifr->ifr_name, sc->enif.if_xname); + strlcpy(ifr->ifr_name, sc->enif.if_xname, + sizeof(ifr->ifr_name)); #else - sprintf(ifr->ifr_name, "%s%d", + snprintf(ifr->ifr_name, sizeof(ifr->ifr_name), "%s%d", sc->enif.if_name, sc->enif.if_unit); #endif } @@ -1312,10 +1313,11 @@ caddr_t data; if ((sifp = en_pvcattach(ifp)) != NULL) { #ifdef __NetBSD__ - strcpy(ifr->ifr_name, sifp->if_xname); + strlcpy(ifr->ifr_name, sifp->if_xname, + sizeof(ifr->ifr_name)); #else - sprintf(ifr->ifr_name, "%s%d", - sifp->if_name, sifp->if_unit); + snprintf(ifr->ifr_name, sizeof(ifr->ifr_name), "%s%d", + sifp->if_name, sifp->if_unit); #endif #if defined(__KAME__) && defined(INET6) /* get EUI64 for PVC, from ATM hardware interface */ @@ -3932,10 +3934,11 @@ static int en_pvctx(sc, pvcreq) struct pvcsif *pvcsif = (struct pvcsif *)ifp; #ifdef __NetBSD__ - strcpy(pvcreq->pvc_ifname, sc->enif.if_xname); + strlcpy(pvcreq->pvc_ifname, sc->enif.if_xname, + sizeof(pvcreq->pvc_ifname)); #else - sprintf(pvcreq->pvc_ifname, "%s%d", - sc->enif.if_name, sc->enif.if_unit); + snprintf(pvcreq->pvc_ifname, sizeof(pvcreq->pvc_ifname), "%s%d", + sc->enif.if_name, sc->enif.if_unit); #endif ATM_PH_FLAGS(&api.aph) = (ATM_PH_FLAGS(pvc_aph) & (ATM_PH_AAL5|ATM_PH_LLCSNAP)); @@ -3996,10 +3999,11 @@ static int en_pvctxget(sc, pvcreq) else { /* pvc subinterface */ #ifdef __NetBSD__ - strcpy(pvcreq->pvc_ifname, sc->enif.if_xname); + strlcpy(pvcreq->pvc_ifname, sc->enif.if_xname, + sizeof(pvcreq->pvc_ifname)); #else - sprintf(pvcreq->pvc_ifname, "%s%d", - sc->enif.if_name, sc->enif.if_unit); + snprintf(pvcreq->pvc_ifname, sizeof(pvcreq->pvc_ifname), "%s%d", + sc->enif.if_name, sc->enif.if_unit); #endif pvcsif = (struct pvcsif *)ifp; diff --git a/sys/dev/ic/mlx.c b/sys/dev/ic/mlx.c index 8f75632abec..55bcf0b7a10 100644 --- a/sys/dev/ic/mlx.c +++ b/sys/dev/ic/mlx.c @@ -1,4 +1,4 @@ -/* $NetBSD: mlx.c,v 1.28 2003/06/29 22:30:13 fvdl Exp $ */ +/* $NetBSD: mlx.c,v 1.29 2004/04/22 00:17:11 itojun Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.28 2003/06/29 22:30:13 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.29 2004/04/22 00:17:11 itojun Exp $"); #include "ld.h" @@ -546,7 +546,7 @@ mlx_describe(struct mlx_softc *mlx) } if (model == NULL) { - sprintf(buf, " model 0x%x", ci->ci_hardware_id); + snprintf(buf, sizeof(buf), " model 0x%x", ci->ci_hardware_id); model = buf; } @@ -2129,12 +2129,12 @@ mlx_ccb_diagnose(struct mlx_ccb *mc) if ((mc->mc_mbox[0] == mlx_msgs[i].command || mlx_msgs[i].command == 0) && mc->mc_status == mlx_msgs[i].status) { - sprintf(buf, "%s (0x%x)", + snprintf(buf, sizeof(buf), "%s (0x%x)", mlx_status_msgs[mlx_msgs[i].msg], mc->mc_status); return (buf); } - sprintf(buf, "unknown response 0x%x for command 0x%x", + snprintf(buf, sizeof(buf), "unknown response 0x%x for command 0x%x", (int)mc->mc_status, (int)mc->mc_mbox[0]); return (buf); diff --git a/sys/dev/ic/nslm7x.c b/sys/dev/ic/nslm7x.c index e9f4de35ec8..8524fdd7343 100644 --- a/sys/dev/ic/nslm7x.c +++ b/sys/dev/ic/nslm7x.c @@ -1,4 +1,4 @@ -/* $NetBSD: nslm7x.c,v 1.17 2002/11/15 14:55:41 ad Exp $ */ +/* $NetBSD: nslm7x.c,v 1.18 2004/04/22 00:17:11 itojun Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.17 2002/11/15 14:55:41 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.18 2004/04/22 00:17:11 itojun Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -271,7 +271,8 @@ lm_common_match(sc) for (i = 0; i < 7; ++i) { sc->sensors[i].units = sc->info[i].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[i].desc, "IN %d", i); + snprintf(sc->info[i].desc, sizeof(sc->info[i].desc), + "IN %d", i); } /* default correction factors for resistors on higher voltage inputs */ @@ -314,7 +315,8 @@ wb_match(sc) for (i = 0; i < 7; ++i) { sc->sensors[i].units = sc->info[i].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[i].desc, "IN %d", i); + snprintf(sc->info[i].desc, sizeof(sc->info[i].desc), + "IN %d", i); } /* default correction factors for higher voltage inputs */ @@ -368,31 +370,31 @@ wb_setup_volt(sc) struct lm_softc *sc; { sc->sensors[0].units = sc->info[0].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[0].desc, "VCORE A"); + snprintf(sc->info[0].desc, sizeof(sc->info[0].desc), "VCORE A"); sc->info[0].rfact = 10000; sc->sensors[1].units = sc->info[1].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[1].desc, "VCORE B"); + snprintf(sc->info[1].desc, sizeof(sc->info[1].desc), "VCORE B"); sc->info[1].rfact = 10000; sc->sensors[2].units = sc->info[2].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[2].desc, "+3.3V"); + snprintf(sc->info[2].desc, sizeof(sc->info[2].desc), "+3.3V"); sc->info[2].rfact = 10000; sc->sensors[3].units = sc->info[3].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[3].desc, "+5V"); + snprintf(sc->info[3].desc, sizeof(sc->info[3].desc), "+5V"); sc->info[3].rfact = 16778; sc->sensors[4].units = sc->info[4].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[4].desc, "+12V"); + snprintf(sc->info[4].desc, sizeof(sc->info[4].desc), "+12V"); sc->info[4].rfact = 38000; sc->sensors[5].units = sc->info[5].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[5].desc, "-12V"); + snprintf(sc->info[5].desc, sizeof(sc->info[5].desc), "-12V"); sc->info[5].rfact = 10000; sc->sensors[6].units = sc->info[6].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[6].desc, "-5V"); + snprintf(sc->info[6].desc, sizeof(sc->info[6].desc), "-5V"); sc->info[6].rfact = 10000; sc->sensors[7].units = sc->info[7].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[7].desc, "+5VSB"); + snprintf(sc->info[7].desc, sizeof(sc->info[7].desc), "+5VSB"); sc->info[7].rfact = 15151; sc->sensors[8].units = sc->info[8].units = ENVSYS_SVOLTS_DC; - sprintf(sc->info[8].desc, "VBAT"); + snprintf(sc->info[8].desc, sizeof(sc->info[8].desc), "VBAT"); sc->info[8].rfact = 10000; } @@ -405,7 +407,8 @@ setup_temp(sc, start, n) for (i = 0; i < n; i++) { sc->sensors[start + i].units = ENVSYS_STEMP; - sprintf(sc->info[start + i].desc, "Temp %d", i + 1); + snprintf(sc->info[start + i].desc, + sizeof(sc->info[start + i].desc), "Temp %d", i + 1); } } @@ -419,7 +422,8 @@ setup_fan(sc, start, n) for (i = 0; i < n; ++i) { sc->sensors[start + i].units = ENVSYS_SFANRPM; sc->info[start + i].units = ENVSYS_SFANRPM; - sprintf(sc->info[start + i].desc, "Fan %d", i + 1); + snprintf(sc->info[start + i].desc, + sizeof(sc->info[start + i].desc), "Fan %d", i + 1); } } diff --git a/sys/dev/ic/opl.c b/sys/dev/ic/opl.c index b1235cd5ffd..c4f44d3f3c2 100644 --- a/sys/dev/ic/opl.c +++ b/sys/dev/ic/opl.c @@ -1,4 +1,4 @@ -/* $NetBSD: opl.c,v 1.20 2003/12/04 13:57:30 keihan Exp $ */ +/* $NetBSD: opl.c,v 1.21 2004/04/22 00:17:11 itojun Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: opl.c,v 1.20 2003/12/04 13:57:30 keihan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: opl.c,v 1.21 2004/04/22 00:17:11 itojun Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -158,7 +158,8 @@ opl_attach(sc) } sc->syn.mets = &opl3_midi; - sprintf(sc->syn.name, "%sYamaha OPL%d", sc->syn.name, sc->model); + snprintf(sc->syn.name, sizeof(sc->syn.name), "%sYamaha OPL%d", + sc->syn.name, sc->model); sc->syn.data = sc; sc->syn.nvoice = sc->model == OPL_2 ? OPL2_NVOICE : OPL3_NVOICE; sc->syn.flags = MS_DOALLOC | MS_FREQXLATE; diff --git a/sys/dev/ic/rrunner.c b/sys/dev/ic/rrunner.c index d71f2680beb..ad411e668da 100644 --- a/sys/dev/ic/rrunner.c +++ b/sys/dev/ic/rrunner.c @@ -1,4 +1,4 @@ -/* $NetBSD: rrunner.c,v 1.44 2003/11/03 03:05:25 ichiro Exp $ */ +/* $NetBSD: rrunner.c,v 1.45 2004/04/22 00:17:11 itojun Exp $ */ /* * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.44 2003/11/03 03:05:25 ichiro Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.45 2004/04/22 00:17:11 itojun Exp $"); #include "opt_inet.h" #include "opt_ns.h" @@ -1469,7 +1469,7 @@ eshintr(arg) int i; buf[0] = '\0'; - strcat(buf, "rc: "); + strlcat(buf, "rc: ", sizeof(buf)); rc_send_consumer = (rc_offsets >> 8) & 0xff; rc_snap_ring_consumer = (rc_offsets >> 16) & 0xff; for (i = 0; i < RR_MAX_RECV_RING; i += 4) { @@ -1479,8 +1479,8 @@ eshintr(arg) /* XXX: should do this right! */ NTOHL(rc_offsets); *((u_int32_t *) &fp_ring_consumer[i]) = rc_offsets; - sprintf(t, "%.8x|", rc_offsets); - strcat(buf, t); + snprintf(t, sizeof(t), "%.8x|", rc_offsets); + strlcat(buf, t, sizeof(buf)); } } start_consumer = sc->sc_event_consumer; @@ -1887,12 +1887,12 @@ eshintr(arg) u_int32_t u; buf[0] = '\0'; - strcat(buf, "drv: "); + strlcat(buf, "drv: ", sizeof(buf)); for (i = 0; i < RR_MAX_RECV_RING; i += 4) { /* XXX: should do this right! */ u = *((u_int32_t *) &fp_ring_consumer[i]); - sprintf(t, "%.8x|", u); - strcat(buf, t); + snprintf(t, sizeof(t), "%.8x|", u); + strlcat(buf, t, sizeof(buf)); NTOHL(u); bus_space_write_4(iot, ioh, RR_DRIVER_RECV_CONS + i, u); @@ -1903,14 +1903,14 @@ eshintr(arg) #endif buf[0] = '\0'; - strcat(buf, "rcn: "); + strlcat(buf, "rcn: ", sizeof(buf)); for (i = 0; i < RR_MAX_RECV_RING; i += 4) { u = bus_space_read_4(iot, ioh, RR_RUNCODE_RECV_CONS + i); /* XXX: should do this right! */ NTOHL(u); - sprintf(t, "%.8x|", u); - strcat(buf, t); + snprintf(t, sizeof(t), "%.8x|", u); + strlcat(buf, t, sizeof(buf)); } #ifdef ESH_PRINTF if (okay == 1) diff --git a/sys/dev/ic/sl811hs.c b/sys/dev/ic/sl811hs.c index 5bd82280f33..52c945ae199 100644 --- a/sys/dev/ic/sl811hs.c +++ b/sys/dev/ic/sl811hs.c @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.3 2003/03/13 06:50:23 bsh Exp $ */ +/* $NetBSD: sl811hs.c,v 1.4 2004/04/22 00:17:11 itojun Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.3 2003/03/13 06:50:23 bsh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.4 2004/04/22 00:17:11 itojun Exp $"); #include "opt_slhci.h" @@ -807,7 +807,8 @@ slhci_root_ctrl_start(usbd_xfer_handle xfer) totlen = slhci_str(buf, len, "ScanLogic"); break; case 2: /* Product */ - sprintf(slbuf, "%s root hub", sltypestr[sc->sc_sltype]); + snprintf(slbuf, sizeof(slbuf), "%s root hub", + sltypestr[sc->sc_sltype]); totlen = slhci_str(buf, len, slbuf); break; default: diff --git a/sys/dev/ic/tms320av110.c b/sys/dev/ic/tms320av110.c index 8e866c44135..8afbb42c738 100644 --- a/sys/dev/ic/tms320av110.c +++ b/sys/dev/ic/tms320av110.c @@ -1,4 +1,4 @@ -/* $NetBSD: tms320av110.c,v 1.12 2003/01/06 13:05:11 wiz Exp $ */ +/* $NetBSD: tms320av110.c,v 1.13 2004/04/22 00:17:11 itojun Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.12 2003/01/06 13:05:11 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.13 2004/04/22 00:17:11 itojun Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -360,10 +360,11 @@ tav_getdev(hdl, ret) iot = sc->sc_iot; ioh = sc->sc_ioh; - strncpy(ret->name, "tms320av110", MAX_AUDIO_DEV_LEN); - sprintf(ret->version, "%u", /* guaranteed to be <= 4 in length */ + strlcpy(ret->name, "tms320av110", sizeof(ret->name)); + /* guaranteed to be <= 4 in length */ + snprintf(ret->version, sizeof(ret->version), "%u", tav_read_byte(iot, ioh, TAV_VERSION)); - strncpy(ret->config, sc->sc_dev.dv_xname, MAX_AUDIO_DEV_LEN); + strlcpy(ret->config, sc->sc_dev.dv_xname, sizeof(ret->config)); return 0; } |
