use bounded string ops

This commit is contained in:
itojun 2004-04-23 21:52:17 +00:00
parent e2c2ba101a
commit 93cf32770f
3 changed files with 11 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ch.c,v 1.58 2003/09/08 01:27:08 mycroft Exp $ */
/* $NetBSD: ch.c,v 1.59 2004/04/23 21:52:17 itojun Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.58 2003/09/08 01:27:08 mycroft Exp $");
__KERNEL_RCSID(0, "$NetBSD: ch.c,v 1.59 2004/04/23 21:52:17 itojun Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -980,8 +980,9 @@ ch_usergetelemstatus(sc, cesr)
(dtperiph = scsipi_lookup_periph(chan,
ces.ces_target, ces.ces_lun)) != NULL &&
dtperiph->periph_dev != NULL) {
strcpy(ces.ces_xname,
dtperiph->periph_dev->dv_xname);
strlcpy(ces.ces_xname,
dtperiph->periph_dev->dv_xname,
sizeof(ces.ces_xname));
ces.ces_flags |= CESTATUS_XNAME_VALID;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_se.c,v 1.45 2003/09/08 01:27:09 mycroft Exp $ */
/* $NetBSD: if_se.c,v 1.46 2004/04/23 21:52:17 itojun Exp $ */
/*
* Copyright (c) 1997 Ian W. Dall <ian.dall@dsto.defence.gov.au>
@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.45 2003/09/08 01:27:09 mycroft Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.46 2004/04/23 21:52:17 itojun Exp $");
#include "opt_inet.h"
#include "opt_atalk.h"
@ -356,7 +356,7 @@ seattach(parent, self, aux)
se_get_addr(sc, myaddr);
/* Initialize ifnet structure. */
strcpy(ifp->if_xname, sc->sc_dev.dv_xname);
strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, sizeof(ifp->if_xname));
ifp->if_softc = sc;
ifp->if_start = se_ifstart;
ifp->if_ioctl = se_ioctl;

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_verbose.c,v 1.21 2004/04/22 00:17:13 itojun Exp $ */
/* $NetBSD: scsipi_verbose.c,v 1.22 2004/04/23 21:52:17 itojun Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsipi_verbose.c,v 1.21 2004/04/22 00:17:13 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsipi_verbose.c,v 1.22 2004/04/23 21:52:17 itojun Exp $");
#include <sys/param.h>
#include <sys/time.h>
@ -766,7 +766,7 @@ scsipi_decode_sense(sinfo, flag)
if (flag == 0 || flag == 2 || flag == 3)
skey = snsbuf[2] & 0xf;
if (flag == 0) { /* Sense Key Only */
(void) strcpy(rqsbuf, sense_keys[skey]);
(void) strlcpy(rqsbuf, sense_keys[skey], sizeof(rqsbuf));
return (rqsbuf);
} else if (flag == 1) { /* ASC/ASCQ Only */
asc2ascii(snsbuf[12], snsbuf[13], rqsbuf, sizeof(rqsbuf));