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>
This commit is contained in:
Archie Cobbs 1998-12-04 22:54:57 +00:00
parent 790eeb2b51
commit 2127f26023
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=41514
123 changed files with 501 additions and 407 deletions

View File

@ -201,7 +201,7 @@ pal_opname(op)
return (pal_op_tbl[i].name);
}
sprintf(unk, "0x%x", op);
snprintf(unk, sizeof(unk), "0x%x", op);
return (unk);
}
@ -257,7 +257,7 @@ arit_name(op)
if (name != NULL)
return (name);
sprintf(unk, "?arit 0x%x?", op);
snprintf(unk, sizeof(unk), "?arit 0x%x?", op);
return (unk);
}
@ -307,7 +307,7 @@ logical_name(op)
if (name != NULL)
return (name);
sprintf(unk, "?logical 0x%x?", op);
snprintf(unk, sizeof(unk), "?logical 0x%x?", op);
return (unk);
}
@ -352,7 +352,7 @@ bitop_name(op)
if (name != NULL)
return (name);
sprintf(unk, "?bit 0x%x?", op);
snprintf(unk, sizeof(unk), "?bit 0x%x?", op);
return (unk);
}
@ -376,7 +376,7 @@ mul_name(op)
if (name != NULL)
return (name);
sprintf(unk, "?mul 0x%x?", op);
snprintf(unk, sizeof(unk), "?mul 0x%x?", op);
return (unk);
}
@ -401,7 +401,7 @@ special_name(op)
if (name != NULL)
return (name);
sprintf(unk, "?special 0x%x?", op);
snprintf(unk, sizeof(unk), "?special 0x%x?", op);
return (unk);
}
@ -440,7 +440,7 @@ intmisc_name(op)
case op_ftois: return ("ftois");
}
sprintf(unk, "?intmisc 0x%x?", op);
snprintf(unk, sizeof(unk), "?intmisc 0x%x?", op);
return (unk);
}
@ -460,7 +460,7 @@ float_name(tbl, op, type)
return (tbl[i].name);
}
sprintf(unk, "?%s 0x%x?", type, op);
snprintf(unk, sizeof(unk), "?%s 0x%x?", type, op);
return (unk);
}

View File

@ -36,7 +36,7 @@
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* from: i386/isa Id: diskslice_machdep.c,v 1.31 1998/08/10 07:22:14 phk Exp
* $Id: diskslice_machdep.c,v 1.4 1998/10/06 08:38:58 dfr Exp $
* $Id: diskslice_machdep.c,v 1.5 1998/10/16 10:13:09 jkh Exp $
*/
#include <sys/param.h>
@ -421,7 +421,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE,
RAW_PART, partname);
strcpy(buf, sname);
snprintf(buf, sizeof(buf), "%s", sname);
if (strlen(buf) < sizeof buf - 11)
strcat(buf, "<extended>");
check_part(buf, dp, base_ext_offset, nsectors,

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: machdep.c,v 1.24 1998/11/25 09:45:27 dfr Exp $
* $Id: machdep.c,v 1.25 1998/12/04 10:52:47 dfr Exp $
*/
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -484,7 +484,7 @@ alpha_unknown_sysname()
{
static char s[128]; /* safe size */
sprintf(s, "%s family, unknown model variation 0x%lx",
snprintf(s, sizeof(s), "%s family, unknown model variation 0x%lx",
platform.family, hwrpb->rpb_variation & SV_ST_MASK);
return ((const char *)s);
}
@ -676,7 +676,7 @@ alpha_init(pfn, ptb, bim, bip, biv)
/* NOTREACHED */
}
cpuinit[cputype].init(cputype);
strcpy(cpu_model, platform.model);
snprintf(cpu_model, sizeof(cpu_model), "%s", platform.model);
/*
* Initalize the real console, so the the bootstrap console is

View File

@ -1,4 +1,4 @@
/* $Id: trap.c,v 1.6 1998/11/18 23:51:40 dfr Exp $ */
/* $Id: trap.c,v 1.7 1998/12/04 10:52:47 dfr Exp $ */
/* $NetBSD: trap.c,v 1.31 1998/03/26 02:21:46 thorpej Exp $ */
/*
@ -154,7 +154,7 @@ printtrap(a0, a1, a2, entry, framep, isfatal, user)
entryname = "system call";
break;
default:
sprintf(ubuf, "type %lx", entry);
snprintf(ubuf, sizeof(ubuf), "type %lx", entry);
entryname = (const char *) ubuf;
break;
}

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: apecs.c,v 1.2 1998/10/06 14:18:40 dfr Exp $
* $Id: apecs.c,v 1.3 1998/11/15 18:25:16 dfr Exp $
*/
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -514,7 +514,7 @@ apecs_attach(device_t dev)
set_iointr(alpha_dispatch_intr);
strcpy(chipset_type, "apecs");
snprintf(chipset_type, sizeof(chipset_type), "apecs");
chipset_bwx = 0;
chipset_ports = APECS_PCI_SIO;
chipset_memory = APECS_PCI_SPARSE;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cia.c,v 1.12 1998/11/28 09:55:16 dfr Exp $
* $Id: cia.c,v 1.13 1998/12/02 09:33:27 dfr Exp $
*/
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -804,13 +804,13 @@ cia_attach(device_t dev)
set_iointr(alpha_dispatch_intr);
if (cia_ispyxis) {
strcpy(chipset_type, "pyxis");
snprintf(chipset_type, sizeof(chipset_type), "pyxis");
chipset_bwx = 1;
chipset_ports = CIA_EV56_BWIO;
chipset_memory = CIA_EV56_BWMEM;
chipset_dense = CIA_PCI_DENSE;
} else {
strcpy(chipset_type, "cia");
snprintf(chipset_type, sizeof(chipset_type), "cia");
chipset_bwx = 0;
chipset_ports = CIA_PCI_SIO1;
chipset_memory = CIA_PCI_SMEM1;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: lca.c,v 1.3 1998/10/06 14:18:40 dfr Exp $
* $Id: lca.c,v 1.4 1998/11/15 18:25:16 dfr Exp $
*/
#include <sys/param.h>
@ -397,7 +397,7 @@ lca_attach(device_t dev)
set_iointr(alpha_dispatch_intr);
strcpy(chipset_type, "lca");
snprintf(chipset_type, sizeof(chipset_type), "lca");
chipset_bwx = 0;
chipset_ports = LCA_PCI_SIO;
chipset_memory = LCA_PCI_SPARSE;

View File

@ -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;

View File

@ -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)

View File

@ -343,7 +343,8 @@ tlsb_node_type_str(u_int32_t dtype)
default:
bzero(tlsb_line, sizeof(tlsb_line));
sprintf(tlsb_line, "unknown, dtype 0x%x", dtype);
snprintf(tlsb_line, sizeof(tlsb_line),
"unknown, dtype 0x%x", dtype);
return (tlsb_line);
}
/* NOTREACHED */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
* $Id: intr_machdep.c,v 1.13 1998/06/18 16:08:46 bde Exp $
* $Id: intr_machdep.c,v 1.14 1998/09/06 22:41:41 tegge Exp $
*/
#include "opt_auto_eoi.h"
@ -325,7 +325,7 @@ find_device_id(int irq)
char *cp;
int free_id, id;
sprintf(buf, "pci irq%d", irq);
snprintf(buf, sizeof(buf), "pci irq%d", irq);
cp = intrnames;
/* default to 0, which corresponds to clk0 */
free_id = 0;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
* $Id: intr_machdep.c,v 1.13 1998/06/18 16:08:46 bde Exp $
* $Id: intr_machdep.c,v 1.14 1998/09/06 22:41:41 tegge Exp $
*/
#include "opt_auto_eoi.h"
@ -325,7 +325,7 @@ find_device_id(int irq)
char *cp;
int free_id, id;
sprintf(buf, "pci irq%d", irq);
snprintf(buf, sizeof(buf), "pci irq%d", irq);
cp = intrnames;
/* default to 0, which corresponds to clk0 */
free_id = 0;

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_all.c,v 1.5 1998/10/02 21:00:54 ken Exp $
* $Id: scsi_all.c,v 1.6 1998/10/15 19:08:58 ken Exp $
*/
#include <sys/param.h>
@ -1563,7 +1563,6 @@ char *
scsi_cdb_string(u_int8_t *cdb_ptr, char *cdb_string, size_t len)
{
u_int8_t cdb_len;
char holdstr[8];
int i;
if (cdb_ptr == NULL)
@ -1608,17 +1607,9 @@ scsi_cdb_string(u_int8_t *cdb_ptr, char *cdb_string, size_t len)
break;
}
*cdb_string = '\0';
for (i = 0; i < cdb_len; i++) {
sprintf(holdstr, "%x ", cdb_ptr[i]);
/*
* If we're about to exceed the length of the string,
* just return what we've already printed.
*/
if (strlen(holdstr) + strlen(cdb_string) > len)
break;
strcat(cdb_string, holdstr);
}
for (i = 0; i < cdb_len; i++)
snprintf(cdb_string + strlen(cdb_string),
len - strlen(cdb_string), "%x ", cdb_ptr[i]);
return(cdb_string);
}

View File

@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_cd.c,v 1.8 1998/10/22 22:16:56 ken Exp $
* $Id: scsi_cd.c,v 1.9 1998/11/22 23:44:46 ken Exp $
*/
/*
* Portions of this driver taken from the original FreeBSD cd driver.
@ -1691,7 +1691,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb)
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
sprintf(announce_buf,
snprintf(announce_buf, sizeof(announce_buf),
"cd present [%lu x %lu byte records]",
cdp->disksize, (u_long)cdp->blksize);
@ -1759,7 +1759,8 @@ cddone(struct cam_periph *periph, union ccb *done_ccb)
if ((have_sense)
&& ((asc == 0x3a) || (asc == 0x04))
&& (error_code == SSD_CURRENT_ERROR))
sprintf(announce_buf,
snprintf(announce_buf,
sizeof(announce_buf),
"Attempt to query device "
"size failed: %s, %s",
scsi_sense_key_text[sense_key],

View File

@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_ch.c,v 1.5 1998/10/22 22:16:56 ken Exp $
* $Id: scsi_ch.c,v 1.6 1998/11/22 23:44:47 ken Exp $
*/
/*
* Derived from the NetBSD SCSI changer driver.
@ -618,7 +618,8 @@ chdone(struct cam_periph *periph, union ccb *done_ccb)
softc->sc_picker = softc->sc_firsts[CHET_MT];
#define PLURAL(c) (c) == 1 ? "" : "s"
sprintf(announce_buf, "%d slot%s, %d drive%s, "
snprintf(announce_buf, sizeof(announce_buf),
"%d slot%s, %d drive%s, "
"%d picker%s, %d portal%s",
softc->sc_counts[CHET_ST],
PLURAL(softc->sc_counts[CHET_ST]),

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_da.c,v 1.12 1998/10/22 22:16:56 ken Exp $
* $Id: scsi_da.c,v 1.13 1998/12/02 17:35:28 ken Exp $
*/
#include "opt_hw_wdog.h"
@ -1286,7 +1286,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
dasetgeom(periph, rdcap);
dp = &softc->params;
sprintf(announce_buf,
snprintf(announce_buf, sizeof(announce_buf),
"%ldMB (%d %d byte sectors: %dH %dS/T %dC)",
dp->sectors / ((1024L * 1024L) / dp->secsize),
dp->sectors, dp->secsize, dp->heads,
@ -1350,7 +1350,8 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
*/
if ((have_sense) && (asc == 0x3a)
&& (error_code == SSD_CURRENT_ERROR))
sprintf(announce_buf,
snprintf(announce_buf,
sizeof(announce_buf),
"Attempt to query device "
"size failed: %s, %s",
scsi_sense_key_text[sense_key],

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_vfsops.c,v 1.8 1998/11/03 08:55:06 peter Exp $
* $Id: coda_vfsops.c,v 1.9 1998/11/16 19:48:26 rvb Exp $
*
*/
@ -47,6 +47,9 @@
/*
* HISTORY
* $Log: coda_vfsops.c,v $
* Revision 1.9 1998/11/16 19:48:26 rvb
* A few bug fixes for Robert Watson
*
* Revision 1.8 1998/11/03 08:55:06 peter
* Support KLD. We register and unregister two modules. "coda" (the vfs)
* via VFS_SET(), and "codadev" for the cdevsw entry. From kldstat -v:
@ -592,8 +595,8 @@ coda_nb_statfs(vfsp, sbp, p)
sbp->f_files = NB_SFS_SIZ;
sbp->f_ffree = NB_SFS_SIZ;
bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t));
strcpy(sbp->f_mntonname, "/coda");
strcpy(sbp->f_mntfromname, "CODA");
snprintf(sbp->f_mntonname, sizeof(sbp->f_mntonname), "/coda");
snprintf(sbp->f_mntfromname, sizeof(sbp->f_mntfromname), "CODA");
/* MARK_INT_SAT(CODA_STATFS_STATS); */
return(0);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_misc.c,v 1.44 1998/09/24 13:25:43 jkh Exp $
* $Id: linux_misc.c,v 1.45 1998/10/05 12:40:42 sos Exp $
*/
#include <sys/param.h>
@ -746,12 +746,18 @@ linux_newuname(struct proc *p, struct linux_newuname_args *args)
printf("Linux-emul(%d): newuname(*)\n", p->p_pid);
#endif
bzero(&linux_newuname, sizeof(struct linux_newuname_t));
strncpy(linux_newuname.sysname, ostype, 64);
strncpy(linux_newuname.nodename, hostname, 64);
strncpy(linux_newuname.release, osrelease, 64);
strncpy(linux_newuname.version, version, 64);
strncpy(linux_newuname.machine, machine, 64);
strncpy(linux_newuname.domainname, domainname, 64);
strncpy(linux_newuname.sysname, ostype,
sizeof(linux_newuname.sysname) - 1);
strncpy(linux_newuname.nodename, hostname,
sizeof(linux_newuname.nodename) - 1);
strncpy(linux_newuname.release, osrelease,
sizeof(linux_newuname.release) - 1);
strncpy(linux_newuname.version, version,
sizeof(linux_newuname.version) - 1);
strncpy(linux_newuname.machine, machine,
sizeof(linux_newuname.machine) - 1);
strncpy(linux_newuname.domainname, domainname,
sizeof(linux_newuname.domainname) - 1);
return (copyout((caddr_t)&linux_newuname, (caddr_t)args->buf,
sizeof(struct linux_newuname_t)));
}

View File

@ -23,7 +23,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: db_sym.c,v 1.25 1998/07/08 09:11:38 bde Exp $
* $Id: db_sym.c,v 1.26 1998/07/08 10:53:51 bde Exp $
*/
/*
@ -91,9 +91,7 @@ db_qualify(sym, symtabname)
static char tmp[256];
db_symbol_values(sym, &symname, 0);
strcpy(tmp,symtabname);
strcat(tmp,":");
strcat(tmp,symname);
snprintf(tmp, sizeof(tmp), "%s:%s", symtabname, symname);
return tmp;
}

View File

@ -32,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: advansys.c,v 1.4 1998/10/15 23:47:14 gibbs Exp $
* $Id: advansys.c,v 1.5 1998/10/29 17:41:34 gibbs Exp $
*/
/*
* Ported from:
@ -134,7 +134,7 @@ adv_name(struct adv_softc *adv)
{
static char name[10];
sprintf(name, "adv%d", adv->unit);
snprintf(name, sizeof(name), "adv%d", adv->unit);
return (name);
}

View File

@ -55,7 +55,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: aha.c,v 1.12 1998/11/10 06:47:09 gibbs Exp $
* $Id: aha.c,v 1.13 1998/11/25 19:12:56 imp Exp $
*/
#include <sys/param.h>
@ -388,31 +388,31 @@ aha_fetch_adapter_info(struct aha_softc *aha)
switch (aha->boardid) {
case BOARD_1540_16HEAD_BIOS:
strcpy(aha->model, "1540 16 head BIOS");
snprintf(aha->model, sizeof(aha->model), "1540 16 head BIOS");
break;
case BOARD_1540_64HEAD_BIOS:
strcpy(aha->model, "1540 64 head BIOS");
snprintf(aha->model, sizeof(aha->model), "1540 64 head BIOS");
break;
case BOARD_1542:
strcpy(aha->model, "1540/1542 64 head BIOS");
snprintf(aha->model, sizeof(aha->model), "1540/1542 64 head BIOS");
break;
case BOARD_1640:
strcpy(aha->model, "1640");
snprintf(aha->model, sizeof(aha->model), "1640");
break;
case BOARD_1740:
strcpy(aha->model, "1740A/1742A/1744");
snprintf(aha->model, sizeof(aha->model), "1740A/1742A/1744");
break;
case BOARD_1542C:
strcpy(aha->model, "1542C");
snprintf(aha->model, sizeof(aha->model), "1542C");
break;
case BOARD_1542CF:
strcpy(aha->model, "1542CF");
snprintf(aha->model, sizeof(aha->model), "1542CF");
break;
case BOARD_1542CP:
strcpy(aha->model, "1542CP");
snprintf(aha->model, sizeof(aha->model), "1542CP");
break;
default:
strcpy(aha->model, "Unknown");
snprintf(aha->model, sizeof(aha->model), "Unknown");
break;
}
/*
@ -663,7 +663,7 @@ aha_name(struct aha_softc *aha)
{
static char name[10];
sprintf(name, "aha%d", aha->unit);
snprintf(name, sizeof(name), "aha%d", aha->unit);
return (name);
}

View File

@ -36,7 +36,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: aic7xxx.c,v 1.9 1998/10/15 23:49:27 gibbs Exp $
* $Id: aic7xxx.c,v 1.10 1998/11/23 01:33:46 gibbs Exp $
*/
/*
* A few notes on features of the driver.
@ -374,7 +374,7 @@ ahc_name(struct ahc_softc *ahc)
{
static char name[10];
sprintf(name, "ahc%d", ahc->unit);
snprintf(name, sizeof(name), "ahc%d", ahc->unit);
return (name);
}

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt.c,v 1.10 1998/11/10 06:47:11 gibbs Exp $
* $Id: bt.c,v 1.11 1998/11/13 13:23:36 gibbs Exp $
*/
/*
@ -449,15 +449,15 @@ bt_fetch_adapter_info(struct bt_softc *bt)
if (esetup_info.bus_type == 'A'
&& bt->firmware_ver[0] == '2') {
strcpy(bt->model, "542B");
snprintf(bt->model, sizeof(bt->model), "542B");
} else if (esetup_info.bus_type == 'E'
&& (strncmp(bt->firmware_ver, "2.1", 3) == 0
|| strncmp(bt->firmware_ver, "2.20", 4) == 0)) {
strcpy(bt->model, "742A");
snprintf(bt->model, sizeof(bt->model), "742A");
} else if (esetup_info.bus_type == 'E'
&& bt->firmware_ver[0] == '0') {
/* AMI FastDisk EISA Series 441 0.x */
strcpy(bt->model, "747A");
snprintf(bt->model, sizeof(bt->model), "747A");
} else {
ha_model_data_t model_data;
int i;
@ -819,7 +819,7 @@ bt_name(struct bt_softc *bt)
{
static char name[10];
sprintf(name, "bt%d", bt->unit);
snprintf(name, sizeof(name), "bt%d", bt->unit);
return (name);
}

View File

@ -36,7 +36,7 @@
* future.
*/
#ident "$Id: dpt_control.c,v 1.8 1998/08/05 00:54:36 eivind Exp $"
#ident "$Id: dpt_control.c,v 1.9 1998/09/15 08:33:31 gibbs Exp $"
#include "opt_dpt.h"
@ -782,7 +782,8 @@ dpt_ioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, struct proc * p)
compat_softc.ha_npend = dpt->submitted_ccbs_count;
compat_softc.ha_active_jobs = dpt->waiting_ccbs_count;
strncpy(compat_softc.ha_fw_version,
dpt->board_data.firmware, 4);
dpt->board_data.firmware,
sizeof(compat_softc.ha_fw_version));
compat_softc.ha_ccb = NULL;
compat_softc.ha_cblist = NULL;
compat_softc.ha_dev = NULL;

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: eisaconf.c,v 1.34 1998/02/09 06:08:09 eivind Exp $
* $Id: eisaconf.c,v 1.35 1998/05/14 19:47:38 gibbs Exp $
*/
#include "opt_eisa.h"
@ -350,7 +350,7 @@ eisa_reg_end(e_dev)
{
char string[25];
sprintf(string, " on %s0 slot %d",
snprintf(string, sizeof(string), " on %s0 slot %d",
mainboard_drv.name,
e_dev->ioconf.slot);
eisa_reg_print(e_dev, string, NULL);
@ -432,7 +432,7 @@ eisa_reg_intr(e_dev, irq, func, arg, maskptr, shared)
return EPERM;
}
sprintf(string, " irq %d", irq);
snprintf(string, sizeof(string), " irq %d", irq);
eisa_reg_print(e_dev, string, reg_state.num_interrupts ?
&separator : NULL);
reg_state.num_interrupts++;

View File

@ -259,7 +259,7 @@ int unit;
enpcis[unit] = scp; /* lock it in */
en_cd.cd_devs[unit] = sc; /* fake a cfdriver structure */
en_cd.cd_ndevs = NEN;
sprintf(sc->sc_dev.dv_xname, "en%d", unit);
snprintf(sc->sc_dev.dv_xname, sizeof(sc->sc_dev.dv_xname), "en%d", unit);
sc->enif.if_unit = unit;
sc->enif.if_name = "en";

View File

@ -1278,8 +1278,8 @@ caddr_t data;
break;
if ((shadow = pvc_attach(ifp)) != NULL) {
sprintf(ifr->ifr_name, "%s%d",
shadow->if_name, shadow->if_unit);
snprintf(ifr->ifr_name, sizeof(ifr->ifr_name),
"%s%d", shadow->if_name, shadow->if_unit);
}
else
error = ENOBUFS;
@ -3643,8 +3643,8 @@ static int en_pvctx(sc, pvcreq)
pvcreq->pvc_ifname);
return (EINVAL);
}
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);
ATM_PH_FLAGS(&api.aph) = ATM_PH_PVCSIF |
(ATM_PH_FLAGS(pvc_aph) & (ATM_PH_AAL5|ATM_PH_LLCSNAP));

View File

@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.123 1998/09/15 22:07:24 gibbs Exp $
* $Id: fd.c,v 1.124 1998/10/22 05:58:38 bde Exp $
*
*/
@ -340,7 +340,7 @@ fd_cmd(fdcu_t fdcu, int n_out, ...)
if (out_fdc(fdcu, va_arg(ap, int)) < 0)
{
char msg[50];
sprintf(msg,
snprintf(msg, sizeof(msg),
"cmd %x failed at out byte %d of %d\n",
cmd, n + 1, n_out);
return fdc_err(fdcu, msg);
@ -353,7 +353,7 @@ fd_cmd(fdcu_t fdcu, int n_out, ...)
if (fd_in(fdcu, ptr) < 0)
{
char msg[50];
sprintf(msg,
snprintf(msg, sizeof(msg),
"cmd %02x failed at in byte %d of %d\n",
cmd, n + 1, n_in);
return fdc_err(fdcu, msg);

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: eni.c,v 1.2 1998/09/17 09:34:58 phk Exp $
* @(#) $Id: eni.c,v 1.3 1998/10/31 20:06:45 phk Exp $
*
*/
@ -42,7 +42,7 @@
#include <dev/hea/eni_var.h>
#ifndef lint
__RCSID("@(#) $Id: eni.c,v 1.2 1998/09/17 09:34:58 phk Exp $");
__RCSID("@(#) $Id: eni.c,v 1.3 1998/10/31 20:06:45 phk Exp $");
#endif
/*
@ -496,10 +496,12 @@ eni_pci_attach ( pcici_t config_id, int unit )
* Make a hw version number from the ID register values.
* Format: {Midway ID}.{Mother board ID}.{Daughter board ID}
*/
sprintf ( eup->eu_config.ac_hard_vers, "%ld/%ld/%ld",
(val >> ID_SHIFT) & ID_MASK,
snprintf ( eup->eu_config.ac_hard_vers,
sizeof ( eup->eu_config.ac_hard_vers ),
"%ld/%ld/%ld",
(val >> ID_SHIFT) & ID_MASK,
(val >> MID_SHIFT) & MID_MASK,
(val >> DID_SHIFT) & DID_MASK );
(val >> DID_SHIFT) & DID_MASK );
/*
* There is no software version number

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: eni_if.c,v 1.1 1998/09/15 08:22:53 phk Exp $
* @(#) $Id: eni_if.c,v 1.2 1998/10/31 20:06:45 phk Exp $
*
*/
@ -43,7 +43,7 @@
#include <dev/hea/eni_var.h>
#ifndef lint
__RCSID("@(#) $Id: eni_if.c,v 1.1 1998/09/15 08:22:53 phk Exp $");
__RCSID("@(#) $Id: eni_if.c,v 1.2 1998/10/31 20:06:45 phk Exp $");
#endif
static void eni_get_stats __P((Eni_unit *));
@ -194,7 +194,8 @@ eni_atm_ioctl ( code, data, arg )
*/
if ( eup == NULL )
return ( ENXIO );
sprintf ( ifname, "%s%d", pip->pif_name, pip->pif_unit );
snprintf ( ifname, sizeof(ifname),
"%s%d", pip->pif_name, pip->pif_unit );
/*
* Cast response structure onto user's buffer

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: fore_command.c,v 1.2 1998/09/17 09:34:58 phk Exp $
* @(#) $Id: fore_command.c,v 1.3 1998/10/31 20:06:52 phk Exp $
*
*/
@ -38,7 +38,7 @@
#include <dev/hfa/fore_include.h>
#ifndef lint
__RCSID("@(#) $Id: fore_command.c,v 1.2 1998/09/17 09:34:58 phk Exp $");
__RCSID("@(#) $Id: fore_command.c,v 1.3 1998/10/31 20:06:52 phk Exp $");
#endif
/*
@ -341,7 +341,8 @@ fore_cmd_drain(fup)
sizeof(struct mac_addr));
fup->fu_config.ac_macaddr =
fup->fu_pif.pif_macaddr;
sprintf(fup->fu_config.ac_hard_vers,
snprintf(fup->fu_config.ac_hard_vers,
sizeof(fup->fu_config.ac_hard_vers),
"%ld.%ld.%ld",
(fp->pr_hwver >> 16) & 0xff,
(fp->pr_hwver >> 8) & 0xff,

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: fore_if.c,v 1.1 1998/09/15 08:22:55 phk Exp $
* @(#) $Id: fore_if.c,v 1.2 1998/10/31 20:06:52 phk Exp $
*
*/
@ -38,7 +38,7 @@
#include <dev/hfa/fore_include.h>
#ifndef lint
__RCSID("@(#) $Id: fore_if.c,v 1.1 1998/09/15 08:22:55 phk Exp $");
__RCSID("@(#) $Id: fore_if.c,v 1.2 1998/10/31 20:06:52 phk Exp $");
#endif
@ -85,7 +85,8 @@ fore_atm_ioctl(code, data, arg)
fup = (Fore_unit *)pip;
if ( pip == NULL )
return ( ENXIO );
sprintf ( ifname, "%s%d", pip->pif_name, pip->pif_unit );
snprintf ( ifname, sizeof(ifname),
"%s%d", pip->pif_name, pip->pif_unit );
/*
* Cast response structure onto user's buffer

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: fore_init.c,v 1.2 1998/09/17 09:34:59 phk Exp $
* @(#) $Id: fore_init.c,v 1.3 1998/10/31 20:06:53 phk Exp $
*
*/
@ -38,7 +38,7 @@
#include <dev/hfa/fore_include.h>
#ifndef lint
__RCSID("@(#) $Id: fore_init.c,v 1.2 1998/09/17 09:34:59 phk Exp $");
__RCSID("@(#) $Id: fore_init.c,v 1.3 1998/10/31 20:06:53 phk Exp $");
#endif
@ -122,7 +122,8 @@ fore_initialize(fup)
errmsg = "unsupported microcode version";
goto failed;
}
sprintf(fup->fu_config.ac_firm_vers, "%ld.%ld.%ld",
snprintf(fup->fu_config.ac_firm_vers,
sizeof(fup->fu_config.ac_firm_vers), "%ld.%ld.%ld",
(vers >> 16) & 0xff, (vers >> 8) & 0xff, vers & 0xff);
#ifdef notdef

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: fore_load.c,v 1.2 1998/09/17 09:34:59 phk Exp $
* @(#) $Id: fore_load.c,v 1.3 1998/10/31 20:06:53 phk Exp $
*
*/
@ -38,7 +38,7 @@
#include <dev/hfa/fore_include.h>
#ifndef lint
__RCSID("@(#) $Id: fore_load.c,v 1.2 1998/09/17 09:34:59 phk Exp $");
__RCSID("@(#) $Id: fore_load.c,v 1.3 1998/10/31 20:06:53 phk Exp $");
#endif
@ -726,10 +726,12 @@ fore_attach(devinfo_p)
val = getprop ( devinfo_p->devi_nodeid, "hw-version", -1 );
}
if (val != -1) {
sprintf(fcp->ac_hard_vers, "%d.%d.%d",
snprintf(fcp->ac_hard_vers,
sizeof(fcp->ac_hard_vers), "%d.%d.%d",
(val >> 16) & 0xff, (val >> 8) & 0xff, val & 0xff);
} else
sprintf(fcp->ac_hard_vers, "Unknown");
snprintf(fcp->ac_hard_vers,
sizeof(fcp->ac_hard_vers), "Unknown");
val = getprop ( devinfo_p->devi_nodeid, "serialnumber", -1 );
if ( val != -1 )

View File

@ -270,7 +270,7 @@ isp_pci_attach(config_id, unit)
pcs->pci_st == IO_SPACE_MAPPING? "I/O" : "Memory");
isp = &pcs->pci_isp;
(void) sprintf(isp->isp_name, "isp%d", unit);
(void) snprintf(isp->isp_name, sizeof(isp->isp_name), "isp%d", unit);
isp->isp_osinfo.unit = unit;
data = pci_conf_read(config_id, PCI_ID_REG);

View File

@ -1300,7 +1300,7 @@ mss_detect(struct isa_device *dev)
}
}
BVDDB(printf("mss_detect() - Detected %s\n", name));
strcpy(d->name, name);
snprintf(d->name, sizeof(d->name), "%s", name);
dev->id_flags &= ~DV_F_DEV_MASK ;
dev->id_flags |= (d->bd_id << DV_F_DEV_SHIFT) & DV_F_DEV_MASK ;
return 1;
@ -1500,7 +1500,7 @@ cs423x_attach(u_long csn, u_long vend_id, char *name,
tmp_d.bd_id = MD_CS4232 ; /* to short-circuit the detect routine */
break;
}
strcpy(tmp_d.name, name);
snprintf(tmp_d.name, sizeof(tmp_d.name), "%s", name);
tmp_d.audio_fmt |= AFMT_FULLDUPLEX ;
}
write_pnp_parms( &d, ldn );
@ -1574,7 +1574,7 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
snddev_last_probed = &tmp_d;
tmp_d = d.flags & DV_PNP_SBCODEC ? sb_op_desc : mss_op_desc ;
strcpy(tmp_d.name, name);
snprintf(tmp_d.name, sizeof(tmp_d.name), "%s", name);
/*
* My MED3931 v.1.0 allocates 3 bytes for the config space,
@ -1780,7 +1780,7 @@ guspnp_attach(u_long csn, u_long vend_id, char *name,
gus_write(tmp_d.conf_base, 0x5b , tmp | 1 );
BVDDB(printf("GUS: silicon rev %c\n", 'A' + ( ( tmp & 0xf ) >> 4) );)
strcpy(tmp_d.name, name);
snprintf(tmp_d.name, sizeof(tmp_d.name), "%s", name);
pcmattach(dev);
}

View File

@ -739,7 +739,8 @@ sb_dsp_init(snddev_info *d, struct isa_device *dev)
}
sprintf(d->name, fmt, (d->bd_id >> 8) &0xff, d->bd_id & 0xff);
snprintf(d->name, sizeof(d->name),
fmt, (d->bd_id >> 8) &0xff, d->bd_id & 0xff);
sb_mix_init(d);
}

View File

@ -1300,7 +1300,7 @@ mss_detect(struct isa_device *dev)
}
}
BVDDB(printf("mss_detect() - Detected %s\n", name));
strcpy(d->name, name);
snprintf(d->name, sizeof(d->name), "%s", name);
dev->id_flags &= ~DV_F_DEV_MASK ;
dev->id_flags |= (d->bd_id << DV_F_DEV_SHIFT) & DV_F_DEV_MASK ;
return 1;
@ -1500,7 +1500,7 @@ cs423x_attach(u_long csn, u_long vend_id, char *name,
tmp_d.bd_id = MD_CS4232 ; /* to short-circuit the detect routine */
break;
}
strcpy(tmp_d.name, name);
snprintf(tmp_d.name, sizeof(tmp_d.name), "%s", name);
tmp_d.audio_fmt |= AFMT_FULLDUPLEX ;
}
write_pnp_parms( &d, ldn );
@ -1574,7 +1574,7 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
snddev_last_probed = &tmp_d;
tmp_d = d.flags & DV_PNP_SBCODEC ? sb_op_desc : mss_op_desc ;
strcpy(tmp_d.name, name);
snprintf(tmp_d.name, sizeof(tmp_d.name), "%s", name);
/*
* My MED3931 v.1.0 allocates 3 bytes for the config space,
@ -1780,7 +1780,7 @@ guspnp_attach(u_long csn, u_long vend_id, char *name,
gus_write(tmp_d.conf_base, 0x5b , tmp | 1 );
BVDDB(printf("GUS: silicon rev %c\n", 'A' + ( ( tmp & 0xf ) >> 4) );)
strcpy(tmp_d.name, name);
snprintf(tmp_d.name, sizeof(tmp_d.name), "%s", name);
pcmattach(dev);
}

View File

@ -739,7 +739,8 @@ sb_dsp_init(snddev_info *d, struct isa_device *dev)
}
sprintf(d->name, fmt, (d->bd_id >> 8) &0xff, d->bd_id & 0xff);
snprintf(d->name, sizeof(d->name),
fmt, (d->bd_id >> 8) &0xff, d->bd_id & 0xff);
sb_mix_init(d);
}

View File

@ -739,7 +739,8 @@ sb_dsp_init(snddev_info *d, struct isa_device *dev)
}
sprintf(d->name, fmt, (d->bd_id >> 8) &0xff, d->bd_id & 0xff);
snprintf(d->name, sizeof(d->name),
fmt, (d->bd_id >> 8) &0xff, d->bd_id & 0xff);
sb_mix_init(d);
}

View File

@ -739,7 +739,8 @@ sb_dsp_init(snddev_info *d, struct isa_device *dev)
}
sprintf(d->name, fmt, (d->bd_id >> 8) &0xff, d->bd_id & 0xff);
snprintf(d->name, sizeof(d->name),
fmt, (d->bd_id >> 8) &0xff, d->bd_id & 0xff);
sb_mix_init(d);
}

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_vfsops.c,v 1.8 1998/11/03 08:55:06 peter Exp $
* $Id: coda_vfsops.c,v 1.9 1998/11/16 19:48:26 rvb Exp $
*
*/
@ -47,6 +47,9 @@
/*
* HISTORY
* $Log: coda_vfsops.c,v $
* Revision 1.9 1998/11/16 19:48:26 rvb
* A few bug fixes for Robert Watson
*
* Revision 1.8 1998/11/03 08:55:06 peter
* Support KLD. We register and unregister two modules. "coda" (the vfs)
* via VFS_SET(), and "codadev" for the cdevsw entry. From kldstat -v:
@ -592,8 +595,8 @@ coda_nb_statfs(vfsp, sbp, p)
sbp->f_files = NB_SFS_SIZ;
sbp->f_ffree = NB_SFS_SIZ;
bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t));
strcpy(sbp->f_mntonname, "/coda");
strcpy(sbp->f_mntfromname, "CODA");
snprintf(sbp->f_mntonname, sizeof(sbp->f_mntonname), "/coda");
snprintf(sbp->f_mntfromname, sizeof(sbp->f_mntfromname), "CODA");
/* MARK_INT_SAT(CODA_STATFS_STATS); */
return(0);
}

View File

@ -36,7 +36,7 @@
*
* @(#)procfs_status.c 8.3 (Berkeley) 2/17/94
*
* $Id: procfs_map.c,v 1.16 1998/02/06 12:13:41 eivind Exp $
* $Id: procfs_map.c,v 1.17 1998/04/29 04:28:22 dyson Exp $
*/
#include <sys/param.h>
@ -153,7 +153,8 @@ case OBJT_DEVICE:
* format:
* start, end, resident, private resident, cow, access, type.
*/
sprintf(mebuffer, "0x%x 0x%x %d %d %d %s%s%s %d %d 0x%x %s %s %s\n",
snprintf(mebuffer, sizeof(mebuffer),
"0x%x 0x%x %d %d %d %s%s%s %d %d 0x%x %s %s %s\n",
entry->start, entry->end,
resident, privateresident, id,
(entry->protection & VM_PROT_READ)?"r":"-",

View File

@ -36,7 +36,7 @@
*
* @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95
*
* $Id: procfs_vnops.c,v 1.60 1998/06/25 16:54:41 dt Exp $
* $Id: procfs_vnops.c,v 1.61 1998/07/11 07:45:46 bde Exp $
*/
/*
@ -528,7 +528,7 @@ procfs_getattr(ap)
vap->va_uid = 0;
vap->va_gid = 0;
vap->va_size = vap->va_bytes =
sprintf(buf, "%ld", (long)curproc->p_pid);
snprintf(buf, sizeof(buf), "%ld", (long)curproc->p_pid);
break;
}
@ -944,7 +944,7 @@ procfs_readlink(ap)
if (VTOPFS(ap->a_vp)->pfs_fileno != PROCFS_FILENO(0, Pcurproc))
return (EINVAL);
len = sprintf(buf, "%ld", (long)curproc->p_pid);
len = snprintf(buf, sizeof(buf), "%ld", (long)curproc->p_pid);
return (uiomove((caddr_t)buf, len, ap->a_uio));
}

View File

@ -578,7 +578,7 @@ int attach_awe(void)
/* intialize AWE32 hardware */
awe_initialize();
sprintf(awe_info.name, "AWE32-%s (RAM%dk)",
snprintf(awe_info.name, sizeof(awe_info.name), "AWE32-%s (RAM%dk)",
AWEDRV_VERSION, awe_mem_size/1024);
#ifdef __FreeBSD__
printk("awe0: <SoundBlaster EMU8000 MIDI (RAM%dk)>", awe_mem_size/1024);

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: eisaconf.c,v 1.34 1998/02/09 06:08:09 eivind Exp $
* $Id: eisaconf.c,v 1.35 1998/05/14 19:47:38 gibbs Exp $
*/
#include "opt_eisa.h"
@ -350,7 +350,7 @@ eisa_reg_end(e_dev)
{
char string[25];
sprintf(string, " on %s0 slot %d",
snprintf(string, sizeof(string), " on %s0 slot %d",
mainboard_drv.name,
e_dev->ioconf.slot);
eisa_reg_print(e_dev, string, NULL);
@ -432,7 +432,7 @@ eisa_reg_intr(e_dev, irq, func, arg, maskptr, shared)
return EPERM;
}
sprintf(string, " irq %d", irq);
snprintf(string, sizeof(string), " irq %d", irq);
eisa_reg_print(e_dev, string, reg_state.num_interrupts ?
&separator : NULL);
reg_state.num_interrupts++;

View File

@ -146,7 +146,7 @@ ibcs2_getipdomainname(p, uap)
int len;
/* Get the domain name */
strcpy(hname, hostname);
snprintf(hname, sizeof(hname), "%s", hostname);
dptr = index(hname, '.');
if ( dptr )
dptr++;
@ -177,7 +177,7 @@ ibcs2_setipdomainname(p, uap)
return EINVAL;
/* Get the host's unqualified name (strip off the domain) */
strcpy(hname, hostname);
snprintf(hname, sizeof(hname), "%s", hostname);
ptr = index(hname, '.');
if ( ptr != NULL ) {
ptr++;

View File

@ -221,20 +221,19 @@ ibcs2_utssys(p, uap)
struct ibcs2_utsname sut;
bzero(&sut, ibcs2_utsname_len);
strncpy(sut.sysname, IBCS2_UNAME_SYSNAME, sizeof(sut.sysname));
strncpy(sut.release, IBCS2_UNAME_RELEASE, sizeof(sut.release));
strncpy(sut.version, IBCS2_UNAME_VERSION, sizeof(sut.version));
strncpy(machine_name, hostname, sizeof(machine_name));
strncpy(sut.sysname,
IBCS2_UNAME_SYSNAME, sizeof(sut.sysname) - 1);
strncpy(sut.release,
IBCS2_UNAME_RELEASE, sizeof(sut.release) - 1);
strncpy(sut.version,
IBCS2_UNAME_VERSION, sizeof(sut.version) - 1);
strncpy(machine_name, hostname, sizeof(machine_name) - 1);
machine_name[sizeof(machine_name) - 1] = 0;
p = index(machine_name, '.');
if ( p )
*p = '\0';
strncpy(sut.nodename, machine_name, sizeof(sut.nodename));
strncpy(sut.machine, machine, sizeof(sut.machine));
sut.sysname[sizeof(sut.sysname)-1] = '\0';
sut.release[sizeof(sut.release)-1] = '\0';
sut.version[sizeof(sut.version)-1] = '\0';
sut.nodename[sizeof(sut.nodename)-1] = '\0';
sut.machine[sizeof(sut.machine)-1] = '\0';
strncpy(sut.nodename, machine_name, sizeof(sut.nodename) - 1);
strncpy(sut.machine, machine, sizeof(sut.machine) - 1);
DPRINTF(("IBCS2 uname: sys=%s rel=%s ver=%s node=%s mach=%s\n",
sut.sysname, sut.release, sut.version, sut.nodename,

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: ibcs2_xenix.c,v 1.15 1998/06/02 05:39:07 dyson Exp $
* $Id: ibcs2_xenix.c,v 1.16 1998/08/16 01:21:49 bde Exp $
*/
#include <sys/param.h>
@ -157,14 +157,22 @@ xenix_utsname(struct proc *p, struct xenix_utsname_args *uap)
DPRINTF(("IBCS2: 'xenix sco_utsname'\n"));
bzero(&ibcs2_sco_uname, sizeof(struct ibcs2_sco_utsname));
strncpy(ibcs2_sco_uname.sysname, ostype, 8);
strncpy(ibcs2_sco_uname.nodename, hostname, 8);
strncpy(ibcs2_sco_uname.release, osrelease, 15);
strncpy(ibcs2_sco_uname.kernelid, version, 19);
strncpy(ibcs2_sco_uname.machine, machine, 8);
bcopy("ISA/EISA", ibcs2_sco_uname.bustype, 8);
bcopy("no charge", ibcs2_sco_uname.sysserial, 9);
bcopy("unlim", ibcs2_sco_uname.numusers, 8);
strncpy(ibcs2_sco_uname.sysname, ostype,
sizeof(ibcs2_sco_uname.sysname) - 1);
strncpy(ibcs2_sco_uname.nodename, hostname,
sizeof(ibcs2_sco_uname.nodename) - 1);
strncpy(ibcs2_sco_uname.release, osrelease,
sizeof(ibcs2_sco_uname.release) - 1);
strncpy(ibcs2_sco_uname.kernelid, version,
sizeof(ibcs2_sco_uname.kernelid) - 1);
strncpy(ibcs2_sco_uname.machine, machine,
sizeof(ibcs2_sco_uname.machine) - 1);
strncpy(ibcs2_sco_uname.bustype, "ISA/EISA",
sizeof(ibcs2_sco_uname.bustype) - 1);
strncpy(ibcs2_sco_uname.sysserial, "no charge",
sizeof(ibcs2_sco_uname.sysserial) - 1);
strncpy(ibcs2_sco_uname.numusers, "unlim",
sizeof(ibcs2_sco_uname.numusers) - 1);
ibcs2_sco_uname.sysorigin = 0xFFFF;
ibcs2_sco_uname.sysoem = 0xFFFF;
ibcs2_sco_uname.numcpu = 1;

View File

@ -380,7 +380,7 @@ static char *cmdname (u_char cmd)
case 0xbd: return ("ATAPI_MECH_STATUS");
case 0xbe: return ("READ_CD");
}
sprintf (buf, "[0x%x]", cmd);
snprintf (buf, sizeof(buf), "[0x%x]", cmd);
return (buf);
}

View File

@ -59,7 +59,8 @@ bs_args_copy(bsc, ia, hw)
bsc->sm_offset = 0;
bsc->sc_cfgflags = DVCFG_MINOR(ia->ia_cfgflags);
strcpy(bsc->sc_dvname, bsc->sc_dev.dv_xname);
snprintf(bsc->sc_dvname, sizeof(bsc->sc_dvname),
"%s", bsc->sc_dev.dv_xname);
}
static int

View File

@ -158,7 +158,7 @@ bsprobe(dev)
else
bsc->sm_offset = (u_long) 0;
sprintf(bsc->sc_dvname, "bs%d", unit);
snprintf(bsc->sc_dvname, sizeof(bsc->sc_dvname), "bs%d", unit);
if (dev->id_iobase == 0)
{

View File

@ -417,7 +417,8 @@ int cxioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
case 8: o->iftype = c->board->if8type; break;
}
if (c->master != c->ifp)
sprintf (o->master, "%s%d", c->master->if_name,
snprintf (o->master, sizeof(o->master),
"%s%d", c->master->if_name,
c->master->if_unit);
else
*o->master = 0;

View File

@ -35,7 +35,7 @@
*
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: diskslice_machdep.c,v 1.30 1998/07/25 16:35:06 bde Exp $
* $Id: diskslice_machdep.c,v 1.31 1998/08/10 07:22:14 phk Exp $
*/
#include <sys/param.h>
@ -405,7 +405,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE,
RAW_PART, partname);
strcpy(buf, sname);
snprintf(buf, sizeof(buf), "%s", sname);
if (strlen(buf) < sizeof buf - 11)
strcat(buf, "<extended>");
check_part(buf, dp, base_ext_offset, nsectors,

View File

@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.123 1998/09/15 22:07:24 gibbs Exp $
* $Id: fd.c,v 1.124 1998/10/22 05:58:38 bde Exp $
*
*/
@ -340,7 +340,7 @@ fd_cmd(fdcu_t fdcu, int n_out, ...)
if (out_fdc(fdcu, va_arg(ap, int)) < 0)
{
char msg[50];
sprintf(msg,
snprintf(msg, sizeof(msg),
"cmd %x failed at out byte %d of %d\n",
cmd, n + 1, n_out);
return fdc_err(fdcu, msg);
@ -353,7 +353,7 @@ fd_cmd(fdcu_t fdcu, int n_out, ...)
if (fd_in(fdcu, ptr) < 0)
{
char msg[50];
sprintf(msg,
snprintf(msg, sizeof(msg),
"cmd %02x failed at in byte %d of %d\n",
cmd, n + 1, n_in);
return fdc_err(fdcu, msg);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
* $Id: intr_machdep.c,v 1.13 1998/06/18 16:08:46 bde Exp $
* $Id: intr_machdep.c,v 1.14 1998/09/06 22:41:41 tegge Exp $
*/
#include "opt_auto_eoi.h"
@ -325,7 +325,7 @@ find_device_id(int irq)
char *cp;
int free_id, id;
sprintf(buf, "pci irq%d", irq);
snprintf(buf, sizeof(buf), "pci irq%d", irq);
cp = intrnames;
/* default to 0, which corresponds to clk0 */
free_id = 0;

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: loran.c,v 1.10 1998/10/23 10:45:10 phk Exp $
* $Id: loran.c,v 1.11 1998/10/24 19:55:09 phk Exp $
*
* This device-driver helps the userland controlprogram for a LORAN-C
* receiver avoid monopolizing the CPU.
@ -577,7 +577,8 @@ loranintr(int unit)
outb(PAR, par);
if (status) {
sprintf(lorantext, "Missed: %02x %d %d this:%p next:%p (dummy=%p)\n",
snprintf(lorantext, sizeof(lorantext),
"Missed: %02x %d %d this:%p next:%p (dummy=%p)\n",
status, count, delay, this, next, &dummy);
loranerror = 1;
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
* $Id: intr_machdep.c,v 1.13 1998/06/18 16:08:46 bde Exp $
* $Id: intr_machdep.c,v 1.14 1998/09/06 22:41:41 tegge Exp $
*/
#include "opt_auto_eoi.h"
@ -325,7 +325,7 @@ find_device_id(int irq)
char *cp;
int free_id, id;
sprintf(buf, "pci irq%d", irq);
snprintf(buf, sizeof(buf), "pci irq%d", irq);
cp = intrnames;
/* default to 0, which corresponds to clk0 */
free_id = 0;

View File

@ -261,7 +261,7 @@ vgaioctl(Dev_t dev, int cmd, caddr_t data, int flag)
static void
vgapcvtid(struct pcvtid *data)
{
strcpy(data->name, PCVTIDNAME);
snprintf(data->name, sizeof(data->name), "%s", PCVTIDNAME);
data->rmajor = PCVTIDMAJOR;
data->rminor = PCVTIDMINOR;
}

View File

@ -1300,7 +1300,7 @@ mss_detect(struct isa_device *dev)
}
}
BVDDB(printf("mss_detect() - Detected %s\n", name));
strcpy(d->name, name);
snprintf(d->name, sizeof(d->name), "%s", name);
dev->id_flags &= ~DV_F_DEV_MASK ;
dev->id_flags |= (d->bd_id << DV_F_DEV_SHIFT) & DV_F_DEV_MASK ;
return 1;
@ -1500,7 +1500,7 @@ cs423x_attach(u_long csn, u_long vend_id, char *name,
tmp_d.bd_id = MD_CS4232 ; /* to short-circuit the detect routine */
break;
}
strcpy(tmp_d.name, name);
snprintf(tmp_d.name, sizeof(tmp_d.name), "%s", name);
tmp_d.audio_fmt |= AFMT_FULLDUPLEX ;
}
write_pnp_parms( &d, ldn );
@ -1574,7 +1574,7 @@ opti931_attach(u_long csn, u_long vend_id, char *name,
snddev_last_probed = &tmp_d;
tmp_d = d.flags & DV_PNP_SBCODEC ? sb_op_desc : mss_op_desc ;
strcpy(tmp_d.name, name);
snprintf(tmp_d.name, sizeof(tmp_d.name), "%s", name);
/*
* My MED3931 v.1.0 allocates 3 bytes for the config space,
@ -1780,7 +1780,7 @@ guspnp_attach(u_long csn, u_long vend_id, char *name,
gus_write(tmp_d.conf_base, 0x5b , tmp | 1 );
BVDDB(printf("GUS: silicon rev %c\n", 'A' + ( ( tmp & 0xf ) >> 4) );)
strcpy(tmp_d.name, name);
snprintf(tmp_d.name, sizeof(tmp_d.name), "%s", name);
pcmattach(dev);
}

View File

@ -739,7 +739,8 @@ sb_dsp_init(snddev_info *d, struct isa_device *dev)
}
sprintf(d->name, fmt, (d->bd_id >> 8) &0xff, d->bd_id & 0xff);
snprintf(d->name, sizeof(d->name),
fmt, (d->bd_id >> 8) &0xff, d->bd_id & 0xff);
sb_mix_init(d);
}

View File

@ -1300,19 +1300,21 @@ init_status(snddev_info *d)
if (status_len != 0) /* only do init once */
return ;
sprintf(status_buf,
snprintf(status_buf, sizeof(status_buf),
"FreeBSD Audio Driver (981002) " __DATE__ " " __TIME__ "\n"
"Installed devices:\n");
for (i = 0; i < NPCM_MAX; i++) {
if (pcm_info[i].open)
sprintf(status_buf + strlen(status_buf),
snprintf(status_buf + strlen(status_buf),
sizeof(status_buf) - strlen(status_buf),
"pcm%d: <%s> at 0x%x irq %d dma %d:%d\n",
i, pcm_info[i].name, pcm_info[i].io_base,
pcm_info[i].irq,
pcm_info[i].dbuf_out.chan, pcm_info[i].dbuf_in.chan);
if (midi_info[i].open)
sprintf(status_buf + strlen(status_buf),
snprintf(status_buf + strlen(status_buf),
sizeof(status_buf) - strlen(status_buf),
"midi%d: <%s> at 0x%x irq %d dma %d:%d\n",
i, midi_info[i].name, midi_info[i].io_base,
midi_info[i].irq,
@ -1325,7 +1327,8 @@ init_status(snddev_info *d)
case 4 : s = "OPL4"; break;
}
sprintf(status_buf + strlen(status_buf),
snprintf(status_buf + strlen(status_buf),
sizeof(status_buf) - strlen(status_buf),
"sequencer%d: <%s> at 0x%x (not functional)\n",
i, s, pcm_info[i].synth_base);
}

View File

@ -1440,11 +1440,13 @@ ad1848_init(char *name, int io_base, int irq,
outb(io_Status(devc), 0); /* Clear pending interrupts */
if (name != NULL && name[0] != 0)
sprintf(ad1848_pcm_operations[nr_ad1848_devs].name,
"%s (%s)", name, devc->chip_name);
snprintf(ad1848_pcm_operations[nr_ad1848_devs].name,
sizeof(ad1848_pcm_operations[nr_ad1848_devs].name),
"%s (%s)", name, devc->chip_name);
else
sprintf(ad1848_pcm_operations[nr_ad1848_devs].name,
"Generic audio codec (%s)", devc->chip_name);
snprintf(ad1848_pcm_operations[nr_ad1848_devs].name,
sizeof(ad1848_pcm_operations[nr_ad1848_devs].name),
"Generic audio codec (%s)", devc->chip_name);
conf_printf2(ad1848_pcm_operations[nr_ad1848_devs].name,
devc->base, devc->irq, dma_playback, dma_capture);

View File

@ -4517,9 +4517,11 @@ gus_wave_init(struct address_info * hw_config)
}
if (gus_pnp_seen) {
sprintf(gus_info.name, "Gravis %s (%dk)", model_num, (int) gus_mem_size / 1024);
snprintf(gus_info.name, sizeof(gus_info.name),
"Gravis %s (%dk)", model_num, (int) gus_mem_size / 1024);
} else {
sprintf(gus_info.name, "Gravis UltraSound %s (%dk)", model_num, (int) gus_mem_size / 1024);
snprintf(gus_info.name, sizeof(gus_info.name),
"Gravis UltraSound %s (%dk)", model_num, (int) gus_mem_size / 1024);
}
conf_printf(gus_info.name, hw_config);

View File

@ -1002,7 +1002,8 @@ attach_mpu401(struct address_info * hw_config)
MPU_CAP_CLS | MPU_CAP_2PORT;
revision_char = (devc->revision == 0x7f) ? 'M' : ' ';
sprintf(mpu_synth_info[num_midis].name,
snprintf(mpu_synth_info[num_midis].name,
sizeof(mpu_synth_info[num_midis].name),
"MQX-%d%c MIDI Interface #%d",
ports,
revision_char,
@ -1015,7 +1016,8 @@ attach_mpu401(struct address_info * hw_config)
devc->capabilities |= MPU_CAP_SYNC | MPU_CAP_FSK;
sprintf(mpu_synth_info[num_midis].name,
snprintf(mpu_synth_info[num_midis].name,
sizeof(mpu_synth_info[num_midis].name),
"MPU-401 %d.%d%c Midi interface #%d",
(int) (devc->version & 0xf0) >> 4,
devc->version & 0x0f,

View File

@ -325,7 +325,7 @@ attach_pas_card(struct address_info * hw_config)
if ((pas_model = pas_read(CHIP_REV))) {
char temp[100];
sprintf(temp,
snprintf(temp, sizeof(temp),
"%s rev %d", pas_model_names[(int) pas_model],
pas_read(BOARD_REV_ID));
conf_printf(temp, hw_config);

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: pcm86.c,v 1.3 1997/02/22 09:38:14 peter Exp $
* $Id: pcm86.c,v 1.4 1997/06/03 10:25:41 kato Exp $
*/
/*
@ -1890,7 +1890,8 @@ pcm86_detect(struct address_info *hw_config)
outb(opna_iobase + 2, 0x30);
/* Ok. Detection finished. */
sprintf(pcm86_operations.name, board_name[pcm_s.board_type]);
snprintf(pcm86_operations.name, sizeof(pcm86_operations.name),
"%s", board_name[pcm_s.board_type]);
pcm_initialized = NO;
pcm_s.irq = irq;

View File

@ -348,7 +348,7 @@ attach_pss(struct address_info * hw_config)
#endif
pss_initialized = 1;
sprintf(tmp, "ECHO-PSS Rev. %d", id);
snprintf(tmp, sizeof(tmp), "ECHO-PSS Rev. %d", id);
conf_printf(tmp, hw_config);
return;

View File

@ -450,8 +450,8 @@ sb16_dsp_init(struct address_info * hw_config)
if (sbc_major < 4)
return; /* Not a SB16 */
sprintf(sb16_dsp_operations.name, "SoundBlaster 16 %d.%d",
sbc_major, sbc_minor);
snprintf(sb16_dsp_operations.name, sizeof(sb16_dsp_operations.name),
"SoundBlaster 16 %d.%d", sbc_major, sbc_minor);
conf_printf(sb16_dsp_operations.name, hw_config);

View File

@ -1081,7 +1081,8 @@ sb_dsp_init(struct address_info * hw_config)
fmt = "SoundBlaster %d.%d" ;
}
sprintf(sb_dsp_operations.name, fmt, sbc_major, sbc_minor);
snprintf(sb_dsp_operations.name, sizeof(sb_dsp_operations.name),
fmt, sbc_major, sbc_minor);
conf_printf(sb_dsp_operations.name, hw_config);
#if defined(CONFIG_SB16) && defined(CONFIG_SBPRO)

View File

@ -335,7 +335,7 @@ sound_timer_init(struct sound_lowlev_timer * t, char *name)
else
n = num_sound_timers++;
strcpy(sound_timer.info.name, name);
snprintf(sound_timer.info.name, sizeof(sound_timer.info.name), "%s", name);
sound_timer_devs[n] = &sound_timer;
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_misc.c,v 1.44 1998/09/24 13:25:43 jkh Exp $
* $Id: linux_misc.c,v 1.45 1998/10/05 12:40:42 sos Exp $
*/
#include <sys/param.h>
@ -746,12 +746,18 @@ linux_newuname(struct proc *p, struct linux_newuname_args *args)
printf("Linux-emul(%d): newuname(*)\n", p->p_pid);
#endif
bzero(&linux_newuname, sizeof(struct linux_newuname_t));
strncpy(linux_newuname.sysname, ostype, 64);
strncpy(linux_newuname.nodename, hostname, 64);
strncpy(linux_newuname.release, osrelease, 64);
strncpy(linux_newuname.version, version, 64);
strncpy(linux_newuname.machine, machine, 64);
strncpy(linux_newuname.domainname, domainname, 64);
strncpy(linux_newuname.sysname, ostype,
sizeof(linux_newuname.sysname) - 1);
strncpy(linux_newuname.nodename, hostname,
sizeof(linux_newuname.nodename) - 1);
strncpy(linux_newuname.release, osrelease,
sizeof(linux_newuname.release) - 1);
strncpy(linux_newuname.version, version,
sizeof(linux_newuname.version) - 1);
strncpy(linux_newuname.machine, machine,
sizeof(linux_newuname.machine) - 1);
strncpy(linux_newuname.domainname, domainname,
sizeof(linux_newuname.domainname) - 1);
return (copyout((caddr_t)&linux_newuname, (caddr_t)args->buf,
sizeof(struct linux_newuname_t)));
}

View File

@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.123 1998/09/15 22:07:24 gibbs Exp $
* $Id: fd.c,v 1.124 1998/10/22 05:58:38 bde Exp $
*
*/
@ -340,7 +340,7 @@ fd_cmd(fdcu_t fdcu, int n_out, ...)
if (out_fdc(fdcu, va_arg(ap, int)) < 0)
{
char msg[50];
sprintf(msg,
snprintf(msg, sizeof(msg),
"cmd %x failed at out byte %d of %d\n",
cmd, n + 1, n_out);
return fdc_err(fdcu, msg);
@ -353,7 +353,7 @@ fd_cmd(fdcu_t fdcu, int n_out, ...)
if (fd_in(fdcu, ptr) < 0)
{
char msg[50];
sprintf(msg,
snprintf(msg, sizeof(msg),
"cmd %02x failed at in byte %d of %d\n",
cmd, n + 1, n_in);
return fdc_err(fdcu, msg);

View File

@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: imgact_elf.c,v 1.41 1998/10/18 15:55:12 peter Exp $
* $Id: imgact_elf.c,v 1.42 1998/10/25 17:44:50 phk Exp $
*/
#include "opt_rlimit.h"
@ -548,8 +548,8 @@ exec_elf_imgact(struct image_params *imgp)
imgp->proc->p_sysent = brand_info->sysvec;
if (interp != NULL) {
strcpy(path, brand_info->emul_path);
strcat(path, interp);
snprintf(path, sizeof(path), "%s%s",
brand_info->emul_path, interp);
if ((error = elf_load_file(imgp->proc, path, &addr,
&imgp->entry_addr)) != 0) {
uprintf("ELF interpreter %s not found\n", path);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
* $Id: kern_shutdown.c,v 1.41 1998/10/30 05:41:15 msmith Exp $
* $Id: kern_shutdown.c,v 1.42 1998/11/13 22:40:37 msmith Exp $
*/
#include "opt_ddb.h"
@ -427,7 +427,7 @@ panic(const char *fmt, ...)
panicstr = fmt;
va_start(ap, fmt);
(void)vsprintf(buf, fmt, ap);
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
if (panicstr == fmt)
panicstr = buf;
va_end(ap);

View File

@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
* $Id: kern_sysctl.c,v 1.77 1998/09/05 17:13:27 bde Exp $
* $Id: kern_sysctl.c,v 1.78 1998/10/16 03:55:00 peter Exp $
*/
#include "opt_compat.h"
@ -225,7 +225,7 @@ sysctl_sysctl_name SYSCTL_HANDLER_ARGS
while (namelen) {
if (!lsp) {
sprintf(buf,"%d",*name);
snprintf(buf,sizeof(buf),"%d",*name);
if (req->oldidx)
error = SYSCTL_OUT(req, ".", 1);
if (!error)

View File

@ -41,7 +41,7 @@
*
* @(#)subr_autoconf.c 8.1 (Berkeley) 6/10/93
*
* $Id: subr_autoconf.c,v 1.5 1997/09/21 22:00:18 gibbs Exp $
* $Id: subr_autoconf.c,v 1.6 1997/11/18 12:43:41 bde Exp $
*/
#include <sys/param.h>
@ -341,7 +341,7 @@ evcnt_attach(dev, name, ev)
/* ev->ev_next = NULL; */
ev->ev_dev = dev;
/* ev->ev_count = 0; */
strcpy(ev->ev_name, name);
snprintf(ev->ev_name, sizeof(ev->ev_name), "%s", name);
*nextp = ev;
nextp = &ev->ev_next;
}

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: subr_devstat.c,v 1.5 1998/11/14 21:58:51 wollman Exp $
* $Id: subr_devstat.c,v 1.6 1998/11/15 23:57:22 ken Exp $
*/
#include <sys/param.h>
@ -73,6 +73,7 @@ devstat_add_entry(struct devstat *ds, const char *dev_name,
ds->device_number = devstat_current_devnumber++;
ds->unit_number = unit_number;
strncpy(ds->device_name, dev_name, DEVSTAT_NAME_LEN);
ds->device_name[DEVSTAT_NAME_LEN - 1] = 0;
ds->block_size = block_size;
ds->flags = flags;
ds->device_type = device_type;

View File

@ -35,7 +35,7 @@
*
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: diskslice_machdep.c,v 1.30 1998/07/25 16:35:06 bde Exp $
* $Id: diskslice_machdep.c,v 1.31 1998/08/10 07:22:14 phk Exp $
*/
#include <sys/param.h>
@ -405,7 +405,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
sname = dsname(dname, dkunit(dev), WHOLE_DISK_SLICE,
RAW_PART, partname);
strcpy(buf, sname);
snprintf(buf, sizeof(buf), "%s", sname);
if (strlen(buf) < sizeof buf - 11)
strcat(buf, "<extended>");
check_part(buf, dp, base_ext_offset, nsectors,

View File

@ -43,7 +43,7 @@
* from: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: subr_diskslice.c,v 1.58 1998/08/23 20:16:34 phk Exp $
* $Id: subr_diskslice.c,v 1.59 1998/10/17 09:46:42 bde Exp $
*/
#include "opt_devfs.h"
@ -680,13 +680,14 @@ dsname(dname, unit, slice, part, partname)
if (strlen(dname) > 16)
dname = "nametoolong";
sprintf(name, "%s%d", dname, unit);
snprintf(name, sizeof(name), "%s%d", dname, unit);
partname[0] = '\0';
if (slice != WHOLE_DISK_SLICE || part != RAW_PART) {
partname[0] = 'a' + part;
partname[1] = '\0';
if (slice != COMPATIBILITY_SLICE)
sprintf(name + strlen(name), "s%d", slice - 1);
snprintf(name + strlen(name),
sizeof(name) - strlen(name), "s%d", slice - 1);
}
return (name);
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.172 1998/10/31 07:42:03 peter Exp $
* $Id: vfs_subr.c,v 1.173 1998/10/31 14:20:39 peter Exp $
*/
/*
@ -1902,7 +1902,7 @@ vprint(label, vp)
char *label;
register struct vnode *vp;
{
char buf[64];
char buf[96];
if (label != NULL)
printf("%s: %p: ", label, (void *)vp);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.172 1998/10/31 07:42:03 peter Exp $
* $Id: vfs_subr.c,v 1.173 1998/10/31 14:20:39 peter Exp $
*/
/*
@ -1902,7 +1902,7 @@ vprint(label, vp)
char *label;
register struct vnode *vp;
{
char buf[64];
char buf[96];
if (label != NULL)
printf("%s: %p: ", label, (void *)vp);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)kernfs_vnops.c 8.15 (Berkeley) 5/21/95
* $Id: kernfs_vnops.c,v 1.34 1998/06/25 16:54:18 dt Exp $
* $Id: kernfs_vnops.c,v 1.35 1998/07/30 17:40:45 bde Exp $
*/
/*
@ -133,13 +133,13 @@ kernfs_xread(kt, buf, len, lenp)
case KTT_TIME: {
struct timeval tv;
microtime(&tv);
sprintf(buf, "%ld %ld\n", tv.tv_sec, tv.tv_usec);
snprintf(buf, len, "%ld %ld\n", tv.tv_sec, tv.tv_usec);
break;
}
case KTT_INT: {
int *ip = kt->kt_data;
sprintf(buf, "%d\n", *ip);
snprintf(buf, len, "%d\n", *ip);
break;
}
@ -181,7 +181,7 @@ kernfs_xread(kt, buf, len, lenp)
}
case KTT_AVENRUN:
sprintf(buf, "%lu %lu %lu %ld\n",
snprintf(buf, len, "%lu %lu %lu %ld\n",
(u_long)averunnable.ldavg[0], (u_long)averunnable.ldavg[1],
(u_long)averunnable.ldavg[2], averunnable.fscale);
break;

View File

@ -36,7 +36,7 @@
*
* @(#)procfs_status.c 8.3 (Berkeley) 2/17/94
*
* $Id: procfs_map.c,v 1.16 1998/02/06 12:13:41 eivind Exp $
* $Id: procfs_map.c,v 1.17 1998/04/29 04:28:22 dyson Exp $
*/
#include <sys/param.h>
@ -153,7 +153,8 @@ case OBJT_DEVICE:
* format:
* start, end, resident, private resident, cow, access, type.
*/
sprintf(mebuffer, "0x%x 0x%x %d %d %d %s%s%s %d %d 0x%x %s %s %s\n",
snprintf(mebuffer, sizeof(mebuffer),
"0x%x 0x%x %d %d %d %s%s%s %d %d 0x%x %s %s %s\n",
entry->start, entry->end,
resident, privateresident, id,
(entry->protection & VM_PROT_READ)?"r":"-",

View File

@ -36,7 +36,7 @@
*
* @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95
*
* $Id: procfs_vnops.c,v 1.60 1998/06/25 16:54:41 dt Exp $
* $Id: procfs_vnops.c,v 1.61 1998/07/11 07:45:46 bde Exp $
*/
/*
@ -528,7 +528,7 @@ procfs_getattr(ap)
vap->va_uid = 0;
vap->va_gid = 0;
vap->va_size = vap->va_bytes =
sprintf(buf, "%ld", (long)curproc->p_pid);
snprintf(buf, sizeof(buf), "%ld", (long)curproc->p_pid);
break;
}
@ -944,7 +944,7 @@ procfs_readlink(ap)
if (VTOPFS(ap->a_vp)->pfs_fileno != PROCFS_FILENO(0, Pcurproc))
return (EINVAL);
len = sprintf(buf, "%ld", (long)curproc->p_pid);
len = snprintf(buf, sizeof(buf), "%ld", (long)curproc->p_pid);
return (uiomove((caddr_t)buf, len, ap->a_uio));
}

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if.c 8.3 (Berkeley) 1/4/94
* $Id: if.c,v 1.61 1998/07/20 13:21:56 dfr Exp $
* $Id: if.c,v 1.62 1998/08/12 22:51:59 wpaul Exp $
*/
#include "opt_compat.h"
@ -143,7 +143,8 @@ if_attach(ifp)
/*
* create a Link Level name for this device
*/
namelen = sprintf(workbuf, "%s%d", ifp->if_name, ifp->if_unit);
namelen = snprintf(workbuf, sizeof(workbuf),
"%s%d", ifp->if_name, ifp->if_unit);
#define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
masklen = _offsetof(struct sockaddr_dl, sdl_data[0]) + namelen;
socksize = masklen + ifp->if_addrlen;
@ -792,7 +793,8 @@ ifconf(cmd, data)
char workbuf[64];
int ifnlen;
ifnlen = sprintf(workbuf, "%s%d", ifp->if_name, ifp->if_unit);
ifnlen = snprintf(workbuf, sizeof(workbuf),
"%s%d", ifp->if_name, ifp->if_unit);
if(ifnlen + 1 > sizeof ifr.ifr_name) {
error = ENAMETOOLONG;
} else {

View File

@ -521,14 +521,16 @@ pvc_ioctl(shadow, cmd, data)
*/
switch (cmd) {
case SIOCGPVCSIF:
sprintf(ifr->ifr_name, "%s%d", ifp->if_name, ifp->if_unit);
snprintf(ifr->ifr_name, sizeof(ifr->ifr_name),
"%s%d", ifp->if_name, ifp->if_unit);
return (0);
case SIOCGPVCTX:
do {
struct pvctxreq *pvcreq = (struct pvctxreq *)data;
sprintf(pvcreq->pvc_ifname, "%s%d",
snprintf(pvcreq->pvc_ifname,
sizeof(pvcreq->pvc_ifname), "%s%d",
ifp->if_name, ifp->if_unit);
pvcreq->pvc_aph = pvcsif->sif_aph;
} while (0);

View File

@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_mib.c,v 1.4 1997/02/22 09:41:02 peter Exp $
* $Id: if_mib.c,v 1.5 1997/08/02 14:32:38 bde Exp $
*/
#include <sys/param.h>
@ -89,7 +89,8 @@ sysctl_ifdata SYSCTL_HANDLER_ARGS /* XXX bad syntax! */
return ENOENT;
case IFDATA_GENERAL:
ifnlen = sprintf(workbuf, "%s%d", ifp->if_name, ifp->if_unit);
ifnlen = snprintf(workbuf, sizeof(workbuf),
"%s%d", ifp->if_name, ifp->if_unit);
if(ifnlen + 1 > sizeof ifmd.ifmd_name) {
return ENAMETOOLONG;
} else {

View File

@ -17,7 +17,7 @@
*
* From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
*
* $Id: if_spppsubr.c,v 1.44 1998/10/06 20:47:53 joerg Exp $
* $Id: if_spppsubr.c,v 1.45 1998/10/06 21:12:45 joerg Exp $
*/
#include <sys/param.h>
@ -4029,7 +4029,7 @@ sppp_cp_type_name(u_char type)
case ECHO_REPLY: return "echo-reply";
case DISC_REQ: return "discard-req";
}
sprintf (buf, "0x%x", type);
snprintf (buf, sizeof(buf), "0x%x", type);
return buf;
}
@ -4052,7 +4052,7 @@ sppp_auth_type_name(u_short proto, u_char type)
case PAP_NAK: return "nak";
}
}
sprintf (buf, "0x%x", type);
snprintf (buf, sizeof(buf), "0x%x", type);
return buf;
}
@ -4069,7 +4069,7 @@ sppp_lcp_opt_name(u_char opt)
case LCP_OPT_PROTO_COMP: return "proto-comp";
case LCP_OPT_ADDR_COMP: return "addr-comp";
}
sprintf (buf, "0x%x", opt);
snprintf (buf, sizeof(buf), "0x%x", opt);
return buf;
}
@ -4082,7 +4082,7 @@ sppp_ipcp_opt_name(u_char opt)
case IPCP_OPT_COMPRESSION: return "compression";
case IPCP_OPT_ADDRESS: return "address";
}
sprintf (buf, "0x%x", opt);
snprintf (buf, sizeof(buf), "0x%x", opt);
return buf;
}
@ -4127,7 +4127,7 @@ sppp_proto_name(u_short proto)
case PPP_PAP: return "pap";
case PPP_CHAP: return "chap";
}
sprintf(buf, "0x%x", (unsigned)proto);
snprintf(buf, sizeof(buf), "0x%x", (unsigned)proto);
return buf;
}

View File

@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_vlan.c,v 1.2 1998/05/15 20:02:47 wollman Exp $
* $Id: if_vlan.c,v 1.3 1998/08/23 03:07:10 wollman Exp $
*/
/*
@ -334,8 +334,8 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCGETVLAN:
bzero(&vlr, sizeof vlr);
if (ifv->ifv_p) {
sprintf(vlr.vlr_parent, "%s%d", ifv->ifv_p->if_name,
ifv->ifv_p->if_unit);
snprintf(vlr.vlr_parent, sizeof(vlr.vlr_parent),
"%s%d", ifv->ifv_p->if_name, ifv->ifv_p->if_unit);
vlr.vlr_tag = ifv->ifv_tag;
}
error = copyout(&vlr, ifr->ifr_data, sizeof vlr);

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: atm_device.c,v 1.2 1998/09/17 09:34:59 phk Exp $
* @(#) $Id: atm_device.c,v 1.3 1998/10/31 20:06:54 phk Exp $
*
*/
@ -38,7 +38,7 @@
#include <netatm/kern_include.h>
#ifndef lint
__RCSID("@(#) $Id: atm_device.c,v 1.2 1998/09/17 09:34:59 phk Exp $");
__RCSID("@(#) $Id: atm_device.c,v 1.3 1998/10/31 20:06:54 phk Exp $");
#endif
@ -874,7 +874,7 @@ atm_dev_pdu_print(cup, cvp, m, msg)
{
char buf[128];
sprintf(buf, "%s vcc=(%d,%d)", msg,
snprintf(buf, sizeof(buf), "%s vcc=(%d,%d)", msg,
cvp->cv_connvc->cvc_vcc->vc_vpi,
cvp->cv_connvc->cvc_vcc->vc_vci);

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: atm_if.c,v 1.1 1998/09/15 08:22:57 phk Exp $
* @(#) $Id: atm_if.c,v 1.2 1998/10/31 20:06:54 phk Exp $
*
*/
@ -38,7 +38,7 @@
#include <netatm/kern_include.h>
#ifndef lint
__RCSID("@(#) $Id: atm_if.c,v 1.1 1998/09/15 08:22:57 phk Exp $");
__RCSID("@(#) $Id: atm_if.c,v 1.2 1998/10/31 20:06:54 phk Exp $");
#endif
@ -326,8 +326,8 @@ atm_physif_ioctl(code, data, arg)
KM_ZERO((caddr_t)&apr, sizeof(apr));
smp = pip->pif_sigmgr;
sip = pip->pif_siginst;
(void) sprintf(apr.anp_intf, "%s%d", pip->pif_name,
pip->pif_unit );
(void) snprintf(apr.anp_intf, sizeof(apr.anp_intf),
"%s%d", pip->pif_name, pip->pif_unit );
if ( pip->pif_nif )
{
strcpy(apr.anp_nif_pref, pip->pif_nif->nif_if.if_name);
@ -380,14 +380,14 @@ atm_physif_ioctl(code, data, arg)
* Fill in info to be returned
*/
KM_ZERO((caddr_t)&anr, sizeof(anr));
(void) sprintf(anr.anp_intf, "%s%d", ifp->if_name,
ifp->if_unit);
(void) snprintf(anr.anp_intf, sizeof(anr.anp_intf),
"%s%d", ifp->if_name, ifp->if_unit);
IFP_TO_IA(ifp, ia);
if (ia) {
anr.anp_proto_addr = *ia->ia_ifa.ifa_addr;
}
(void) sprintf(anr.anp_phy_intf, "%s%d", pip->pif_name,
pip->pif_unit);
(void) snprintf(anr.anp_phy_intf, sizeof(anr.anp_phy_intf),
"%s%d", pip->pif_name, pip->pif_unit);
/*
* Copy data to user buffer
@ -410,7 +410,8 @@ atm_physif_ioctl(code, data, arg)
pip = (struct atm_pif *)arg;
if ( pip == NULL )
return ( ENXIO );
sprintf ( ifname, "%s%d", pip->pif_name, pip->pif_unit );
snprintf ( ifname, sizeof(ifname),
"%s%d", pip->pif_name, pip->pif_unit );
/*
* Cast response into users buffer
@ -572,8 +573,8 @@ atm_physif_ioctl(code, data, arg)
* Fill in info to be returned
*/
KM_ZERO((caddr_t)&acr, sizeof(acr));
(void) sprintf(acr.acp_intf, "%s%d", pip->pif_name,
pip->pif_unit);
(void) snprintf(acr.acp_intf, sizeof(acr.acp_intf),
"%s%d", pip->pif_name, pip->pif_unit);
KM_COPY((caddr_t)acp, (caddr_t)&acr.acp_cfg,
sizeof(Atm_config));

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: atm_socket.c,v 1.1 1998/09/15 08:22:58 phk Exp $
* @(#) $Id: atm_socket.c,v 1.2 1998/10/31 20:06:54 phk Exp $
*
*/
@ -38,7 +38,7 @@
#include <netatm/kern_include.h>
#ifndef lint
__RCSID("@(#) $Id: atm_socket.c,v 1.1 1998/09/15 08:22:58 phk Exp $");
__RCSID("@(#) $Id: atm_socket.c,v 1.2 1998/10/31 20:06:54 phk Exp $");
#endif
@ -1207,8 +1207,8 @@ atm_sock_getopt(so, sopt, atp)
struct ifnet *ifp;
ifp = &ap->nif->nif_if;
(void) sprintf(netif.net_intf, "%s%d",
ifp->if_name, ifp->if_unit);
(void) snprintf(netif.net_intf, sizeof(netif.net_intf),
"%s%d", ifp->if_name, ifp->if_unit);
return (sooptcopyout(sopt, &netif,
sizeof netif));
} else {

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: ipatm_usrreq.c,v 1.1 1998/09/15 08:23:01 phk Exp $
* @(#) $Id: ipatm_usrreq.c,v 1.2 1998/10/31 20:06:55 phk Exp $
*
*/
@ -42,7 +42,7 @@
#include <netatm/ipatm/ipatm_serv.h>
#ifndef lint
__RCSID("@(#) $Id: ipatm_usrreq.c,v 1.1 1998/09/15 08:23:01 phk Exp $");
__RCSID("@(#) $Id: ipatm_usrreq.c,v 1.2 1998/10/31 20:06:55 phk Exp $");
#endif
@ -333,7 +333,8 @@ ipatm_ioctl(code, data, arg1)
AF_INET;
SATOSIN(&aivr.aip_dst_addr)->sin_addr.s_addr =
ivp->iv_dst.s_addr;
(void) sprintf(aivr.aip_intf, "%s%d",
(void) snprintf(aivr.aip_intf,
sizeof(aivr.aip_intf), "%s%d",
inp->inf_nif->nif_if.if_name,
inp->inf_nif->nif_if.if_unit);
if ((ivp->iv_conn) &&

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: sigpvc_if.c,v 1.1 1998/09/15 08:23:02 phk Exp $
* @(#) $Id: sigpvc_if.c,v 1.2 1998/10/31 20:06:56 phk Exp $
*
*/
@ -46,7 +46,7 @@
#include <netatm/sigpvc/sigpvc_var.h>
#ifndef lint
__RCSID("@(#) $Id: sigpvc_if.c,v 1.1 1998/09/15 08:23:02 phk Exp $");
__RCSID("@(#) $Id: sigpvc_if.c,v 1.2 1998/10/31 20:06:56 phk Exp $");
#endif
@ -604,7 +604,8 @@ sigpvc_ioctl(code, data, arg1)
/*
* Fill in info to be returned
*/
(void) sprintf(avr.avp_intf, "%s%d",
(void) snprintf(avr.avp_intf, sizeof(avr.avp_intf),
"%s%d",
pvp->pv_pif->pif_name, pvp->pv_pif->pif_unit);
avr.avp_vpi = vcp->vc_vpi;
avr.avp_vci = vcp->vc_vci;

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: spans_arp.c,v 1.1 1998/09/15 08:23:02 phk Exp $
* @(#) $Id: spans_arp.c,v 1.2 1998/10/31 20:06:56 phk Exp $
*
*/
@ -44,7 +44,7 @@
#include <netatm/spans/spans_cls.h>
#ifndef lint
__RCSID("@(#) $Id: spans_arp.c,v 1.1 1998/09/15 08:23:02 phk Exp $");
__RCSID("@(#) $Id: spans_arp.c,v 1.2 1998/10/31 20:06:56 phk Exp $");
#endif
@ -1089,7 +1089,8 @@ spansarp_ioctl(code, data, arg1)
AF_INET;
SATOSIN(&aar.aap_arp_addr)->sin_addr.s_addr =
sap->sa_dstip.s_addr;
(void) sprintf(aar.aap_intf, "%s%d",
(void) snprintf(aar.aap_intf,
sizeof(aar.aap_intf), "%s%d",
clp->cls_ipnif->inf_nif->nif_if.if_name,
clp->cls_ipnif->inf_nif->nif_if.if_unit
);

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: spans_cls.c,v 1.1 1998/09/15 08:23:03 phk Exp $
* @(#) $Id: spans_cls.c,v 1.2 1998/10/31 20:06:56 phk Exp $
*
*/
@ -44,7 +44,7 @@
#include <netatm/spans/spans_cls.h>
#ifndef lint
__RCSID("@(#) $Id: spans_cls.c,v 1.1 1998/09/15 08:23:03 phk Exp $");
__RCSID("@(#) $Id: spans_cls.c,v 1.2 1998/10/31 20:06:56 phk Exp $");
#endif
@ -842,7 +842,7 @@ spanscls_pdu_print(clp, m, msg)
{
char buf[128];
sprintf(buf, "spanscls %s:\n", msg);
snprintf(buf, sizeof(buf), "spanscls %s:\n", msg);
atm_pdu_print(m, buf);
}

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: spans_if.c,v 1.2 1998/09/17 09:35:00 phk Exp $
* @(#) $Id: spans_if.c,v 1.3 1998/10/31 20:06:56 phk Exp $
*
*/
@ -46,7 +46,7 @@
#include <netatm/spans/spans_var.h>
#ifndef lint
__RCSID("@(#) $Id: spans_if.c,v 1.2 1998/09/17 09:35:00 phk Exp $");
__RCSID("@(#) $Id: spans_if.c,v 1.3 1998/10/31 20:06:56 phk Exp $");
#endif
/*
@ -972,7 +972,8 @@ spans_ioctl(code, data, arg1)
/*
* Fill out the response struct for the VCC
*/
(void) sprintf(rsp.avp_intf, "%s%d",
(void) snprintf(rsp.avp_intf,
sizeof(rsp.avp_intf), "%s%d",
spp->sp_pif->pif_name,
spp->sp_pif->pif_unit);
rsp.avp_vpi = svp->sv_vpi;

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: spans_print.c,v 1.2 1998/09/17 09:35:00 phk Exp $
* @(#) $Id: spans_print.c,v 1.3 1998/10/31 20:06:56 phk Exp $
*
*/
@ -41,7 +41,7 @@
#include <netatm/spans/spans_var.h>
#ifndef lint
__RCSID("@(#) $Id: spans_print.c,v 1.2 1998/09/17 09:35:00 phk Exp $");
__RCSID("@(#) $Id: spans_print.c,v 1.3 1998/10/31 20:06:56 phk Exp $");
#endif
/*
@ -54,17 +54,17 @@ __RCSID("@(#) $Id: spans_print.c,v 1.2 1998/09/17 09:35:00 phk Exp $");
/*
* Local functions
*/
static void spans_msgtype_str __P((spans_msgtype *, char *));
static void spans_msgtype_str __P((spans_msgtype *, char *, int));
static void spans_print_msgbody __P((spans_msgbody *));
static void spans_result_str __P((spans_result *, char *));
static void spans_result_str __P((spans_result *, char *, int));
#ifdef LONGPRINT
static void inc_indent __P((void));
static void dec_indent __P((void));
static void spans_aal_str __P((spans_aal *, char *));
static void spans_query_type_str __P((spans_query_type *, char *));
static void spans_state_str __P((spans_query_type *, char *));
static void spans_aal_str __P((spans_aal *, char *, int));
static void spans_query_type_str __P((spans_query_type *, char *, int));
static void spans_state_str __P((spans_query_type *, char *, int));
static void spans_print_version __P((spans_version *));
static void spans_print_vpvc __P((spans_vpvc *));
static void spans_print_vpvc_pref __P((spans_vpvc_pref *));
@ -132,9 +132,10 @@ dec_indent()
}
static void
spans_aal_str(objp, dest)
spans_aal_str(objp, dest, len)
spans_aal *objp;
char *dest;
int len;
{
static char *aal_names[] = {
"SPANS_AAL0",
@ -146,9 +147,9 @@ spans_aal_str(objp, dest)
};
if (*objp < SPANS_AAL0 || *objp > SPANS_AAL5) {
sprintf(dest, "Invalid (%d)", (int)*objp);
snprintf(dest, len, "Invalid (%d)", (int)*objp);
} else {
sprintf(dest, "%s (%d)", aal_names[(int)*objp],
snprintf(dest, len, "%s (%d)", aal_names[(int)*objp],
(int)*objp);
}
}
@ -156,9 +157,10 @@ spans_aal_str(objp, dest)
#endif
static void
spans_result_str(objp, dest)
spans_result_str(objp, dest, len)
spans_result *objp;
char *dest;
int len;
{
static char *result_names[] = {
"SPANS_OK",
@ -169,17 +171,18 @@ spans_result_str(objp, dest)
};
if (*objp < SPANS_OK || *objp > SPANS_BADDEST) {
sprintf(dest, "Invalid (%d)", (int)*objp);
snprintf(dest, len, "Invalid (%d)", (int)*objp);
} else {
sprintf(dest, "%s (%d)",
snprintf(dest, len, "%s (%d)",
result_names[(int)*objp], (int)*objp);
}
}
static void
spans_msgtype_str(objp, dest)
spans_msgtype_str(objp, dest, len)
spans_msgtype *objp;
char *dest;
int len;
{
int i;
@ -225,7 +228,7 @@ spans_msgtype_str(objp, dest)
*/
for (i=0; msgtype_names[i].name; i++) {
if (*objp == msgtype_names[i].type) {
sprintf(dest, "%s (%d)",
snprintf(dest, len, "%s (%d)",
msgtype_names[i].name,
(int)*objp);
return;
@ -235,15 +238,16 @@ spans_msgtype_str(objp, dest)
/*
* Type was not found--return an error indicator
*/
sprintf(dest, "Invalid (%d)", (int)*objp);
snprintf(dest, len, "Invalid (%d)", (int)*objp);
}
#ifdef LONGPRINT
static void
spans_query_type_str(objp, dest)
spans_query_type_str(objp, dest, len)
spans_query_type *objp;
char *dest;
int len;
{
static char *query_names[] = {
"SPANS_QUERY_NORMAL",
@ -253,17 +257,18 @@ spans_query_type_str(objp, dest)
if (*objp < SPANS_QUERY_NORMAL ||
*objp > SPANS_QUERY_END_TO_END) {
sprintf(dest, "Invalid (%d)", (int)*objp);
snprintf(dest, len, "Invalid (%d)", (int)*objp);
} else {
sprintf(dest, "%s (%d)", query_names[(int)*objp],
snprintf(dest, len, "%s (%d)", query_names[(int)*objp],
(int)*objp);
}
}
static void
spans_state_str(objp, dest)
spans_state_str(objp, dest, len)
spans_query_type *objp;
char *dest;
int len;
{
static char *state_names[] = {
"SPANS_CONN_OPEN",
@ -273,9 +278,9 @@ spans_state_str(objp, dest)
};
if (*objp < SPANS_CONN_OPEN || *objp > SPANS_CONN_CLOSED) {
sprintf(dest, "Invalid (%d)", (int)*objp);
snprintf(dest, len, "Invalid (%d)", (int)*objp);
} else {
sprintf(dest, "%s (%d)", state_names[(int)*objp],
snprintf(dest, len, "%s (%d)", state_names[(int)*objp],
(int)*objp);
}
}
@ -357,7 +362,7 @@ spans_print_aal(objp)
{
char aal_str[80];
spans_aal_str(objp, aal_str);
spans_aal_str(objp, aal_str, sizeof(aal_str));
printf("%sspans_aal %s\n", spans_indent, aal_str);
}
@ -367,7 +372,7 @@ spans_print_result(objp)
{
char result_str[80];
spans_result_str(objp, result_str);
spans_result_str(objp, result_str, sizeof(result_str));
printf("%sspans_result %s\n", spans_indent, result_str);
}
@ -377,7 +382,7 @@ spans_print_msgtype(objp)
{
char msgtype_str[80];
spans_msgtype_str(objp, msgtype_str);
spans_msgtype_str(objp, msgtype_str, sizeof(msgtype_str));
printf("%sspans_msgtype %s\n", spans_indent, msgtype_str);
}
@ -717,7 +722,8 @@ spans_print_parm_query_req(objp)
printf("%sspans_parm_query_req\n", spans_indent);
inc_indent();
spans_print_atm_conn(&objp->qyreq_conn);
spans_query_type_str(&objp->qyreq_type, query_type_str);
spans_query_type_str(&objp->qyreq_type,
query_type_str, sizeof(query_type_str));
printf("%sqyreq_type %s\n", spans_indent, query_type_str);
dec_indent();
}
@ -731,9 +737,11 @@ spans_print_parm_query_rsp(objp)
printf("%sspans_parm_query_rsp\n", spans_indent);
inc_indent();
spans_print_atm_conn(&objp->qyrsp_conn);
spans_query_type_str(&objp->qyrsp_type, query_type_str);
spans_query_type_str(&objp->qyrsp_type,
query_type_str, sizeof(query_type_str));
printf("%sqyrsp_type %s\n", spans_indent, query_type_str);
spans_state_str(&objp->qyrsp_state, state_type_str);
spans_state_str(&objp->qyrsp_state,
state_type_str, sizeof(state_type_str));
printf("%sqyrsp_state %s\n", spans_indent, state_type_str);
printf("%sqyrsp_data 0x%x\n", spans_indent,
objp->qyrsp_data);
@ -877,7 +885,7 @@ spans_print_msgbody(objp)
spans_parm_rclose_rsp *rcrsp_p;
spans_parm_rclose_cnf *rccnf_p;
spans_msgtype_str(&objp->mb_type, msgtype_str);
spans_msgtype_str(&objp->mb_type, msgtype_str, sizeof(msgtype_str));
printf("%s: ", msgtype_str);
switch (objp->mb_type) {
case SPANS_STAT_REQ:
@ -889,7 +897,7 @@ spans_print_msgbody(objp)
strncpy(daddr, spans_addr_print(&stind_p->stind_es_addr),
sizeof(daddr));
strncpy(saddr, spans_addr_print(&stind_p->stind_sw_addr),
sizeof(daddr));
sizeof(saddr));
printf("sw_epoch=0x%lx, es_addr=%s, sw_addr=0x%s",
stind_p->stind_sw_epoch,
daddr, saddr);
@ -939,7 +947,8 @@ spans_print_msgbody(objp)
sizeof(daddr));
strncpy(saddr, spans_addr_print(&oprsp_p->oprsp_conn.con_src),
sizeof(saddr));
spans_result_str(&oprsp_p->oprsp_result, result_str);
spans_result_str(&oprsp_p->oprsp_result, result_str,
sizeof(result_str));
printf("result=%s, daddr=%s, saddr=%s, dsap=%d, ssap=%d, vp.vc=%d.%d",
result_str, daddr, saddr,
oprsp_p->oprsp_conn.con_dsap,
@ -953,7 +962,8 @@ spans_print_msgbody(objp)
sizeof(daddr));
strncpy(saddr, spans_addr_print(&opcnf_p->opcnf_conn.con_src),
sizeof(saddr));
spans_result_str(&opcnf_p->opcnf_result, result_str);
spans_result_str(&opcnf_p->opcnf_result, result_str,
sizeof(result_str));
printf("result=%s, daddr=%s, saddr=%s, dsap=%d, ssap=%d, vp.vc=%d.%d",
result_str, daddr, saddr,
opcnf_p->opcnf_conn.con_dsap,
@ -989,7 +999,8 @@ spans_print_msgbody(objp)
sizeof(daddr));
strncpy(saddr, spans_addr_print(&clrsp_p->clrsp_conn.con_src),
sizeof(saddr));
spans_result_str(&clrsp_p->clrsp_result, result_str);
spans_result_str(&clrsp_p->clrsp_result, result_str,
sizeof(result_str));
printf("result=%s, daddr=%s, saddr=%s, dsap=%d, ssap=%d",
result_str, daddr, saddr,
clrsp_p->clrsp_conn.con_dsap,
@ -1001,7 +1012,8 @@ spans_print_msgbody(objp)
sizeof(daddr));
strncpy(saddr, spans_addr_print(&clcnf_p->clcnf_conn.con_src),
sizeof(saddr));
spans_result_str(&clcnf_p->clcnf_result, result_str);
spans_result_str(&clcnf_p->clcnf_result, result_str,
sizeof(result_str));
printf("result=%s, daddr=%s, saddr=%s, dsap=%d, ssap=%d",
result_str, daddr, saddr,
clcnf_p->clcnf_conn.con_dsap,
@ -1035,7 +1047,8 @@ spans_print_msgbody(objp)
sizeof(daddr));
strncpy(saddr, spans_addr_print(&rcrsp_p->rcrsp_conn.con_src),
sizeof(saddr));
spans_result_str(&rcrsp_p->rcrsp_result, result_str);
spans_result_str(&rcrsp_p->rcrsp_result, result_str,
sizeof(result_str));
printf("result=%s, daddr=%s, saddr=%s, dsap=%d, ssap=%d",
result_str, daddr, saddr,
rcrsp_p->rcrsp_conn.con_dsap,
@ -1047,7 +1060,8 @@ spans_print_msgbody(objp)
sizeof(daddr));
strncpy(saddr, spans_addr_print(&rccnf_p->rccnf_conn.con_src),
sizeof(saddr));
spans_result_str(&rccnf_p->rccnf_result, result_str);
spans_result_str(&rccnf_p->rccnf_result, result_str,
sizeof(result_str));
printf("result=%s, daddr=%s, saddr=%s, dsap=%d, ssap=%d",
result_str, daddr, saddr,
rccnf_p->rccnf_conn.con_dsap,

View File

@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
* @(#) $Id: sscf_uni.c,v 1.2 1998/09/17 09:35:01 phk Exp $
* @(#) $Id: sscf_uni.c,v 1.3 1998/10/31 20:07:00 phk Exp $
*
*/
@ -43,7 +43,7 @@
#include <netatm/uni/sscf_uni_var.h>
#ifndef lint
__RCSID("@(#) $Id: sscf_uni.c,v 1.2 1998/09/17 09:35:01 phk Exp $");
__RCSID("@(#) $Id: sscf_uni.c,v 1.3 1998/10/31 20:07:00 phk Exp $");
#endif
@ -310,7 +310,7 @@ sscf_uni_pdu_print(uvp, m, msg)
struct vccb *vcp;
vcp = uvp->uv_connvc->cvc_vcc;
sprintf(buf, "sscf_uni %s: vcc=(%d,%d)\n",
snprintf(buf, sizeof(buf), "sscf_uni %s: vcc=(%d,%d)\n",
msg, vcp->vc_vpi, vcp->vc_vci);
atm_pdu_print(m, buf);
}

Some files were not shown because too many files have changed in this diff Show More