summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/alpha/alpha/autoconf.c6
-rw-r--r--sys/arch/alpha/alpha/cpu.c5
-rw-r--r--sys/arch/alpha/alpha/machdep.c4
-rw-r--r--sys/arch/alpha/pci/pci_550.c4
-rw-r--r--sys/arch/alpha/pci/sio_pic.c4
-rw-r--r--sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c9
-rw-r--r--sys/arch/hppa/dev/mongoose.c4
-rw-r--r--sys/arch/hppa/gsc/harmony.c79
-rw-r--r--sys/arch/hppa/hppa/autoconf.c6
-rw-r--r--sys/arch/hppa/hppa/machdep.c7
-rw-r--r--sys/arch/hppa/stand/mkboot/mkboot.c9
-rw-r--r--sys/arch/mac68k/mac68k/autoconf.c4
-rw-r--r--sys/arch/mac68k/mac68k/pram.c5
-rw-r--r--sys/arch/macppc/dev/awacs.c54
-rw-r--r--sys/arch/macppc/dev/pm_direct.c5
-rw-r--r--sys/arch/mvme68k/mvme68k/hpux_machdep.c5
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c5
-rw-r--r--sys/arch/mvmeppc/dev/cpu.c28
-rw-r--r--sys/arch/mvmeppc/pci/mpcpcibr.c4
-rw-r--r--sys/arch/mvmeppc/pci/raven.c4
-rw-r--r--sys/arch/sparc/dev/amd7930.c45
-rw-r--r--sys/arch/sparc/dev/cs4231.c97
-rw-r--r--sys/arch/sparc64/dev/ce4231.c96
-rw-r--r--sys/arch/vax/bi/if_ni.c4
-rw-r--r--sys/arch/vax/if/if_qe.c4
-rw-r--r--sys/arch/vax/if/sgec.c4
-rw-r--r--sys/arch/vax/include/cpu.h4
-rw-r--r--sys/arch/vax/qbus/if_de.c4
-rw-r--r--sys/arch/vax/vax/clock.c4
-rw-r--r--sys/arch/vax/vax/ka820.c4
-rw-r--r--sys/arch/vax/vax/rootfil.c4
-rw-r--r--sys/arch/vax/vax/uvaxII.c10
-rw-r--r--sys/arch/vax/vsa/hdc9224.c9
33 files changed, 308 insertions, 232 deletions
diff --git a/sys/arch/alpha/alpha/autoconf.c b/sys/arch/alpha/alpha/autoconf.c
index e1459f88236..59699e37717 100644
--- a/sys/arch/alpha/alpha/autoconf.c
+++ b/sys/arch/alpha/alpha/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.20 2003/05/10 21:11:11 deraadt Exp $ */
+/* $OpenBSD: autoconf.c,v 1.21 2003/05/11 19:41:08 deraadt Exp $ */
/* $NetBSD: autoconf.c,v 1.16 1996/11/13 21:13:04 cgd Exp $ */
/*
@@ -329,7 +329,7 @@ setroot()
printf(": ");
len = getstr(buf, sizeof(buf));
if (len == 0 && bootdv != NULL) {
- strcpy(buf, bootdv->dv_xname);
+ strlcpy(buf, bootdv->dv_xname, sizeof buf);
len = strlen(buf);
}
if (len > 0 && buf[len - 1] == '*') {
@@ -442,7 +442,7 @@ gotswap:
switch (rootdv->dv_class) {
#if defined(NFSCLIENT)
case DV_IFNET:
- strcpy(root_device, "??");
+ strlcpy(root_device, "??", sizeof root_device);
mountroot = nfs_mountroot;
nfsbootdevname = rootdv->dv_xname;
return;
diff --git a/sys/arch/alpha/alpha/cpu.c b/sys/arch/alpha/alpha/cpu.c
index 078bf96aa59..3f57c4707a7 100644
--- a/sys/arch/alpha/alpha/cpu.c
+++ b/sys/arch/alpha/alpha/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.14 2002/10/07 18:35:56 mickey Exp $ */
+/* $OpenBSD: cpu.c,v 1.15 2003/05/11 19:41:08 deraadt Exp $ */
/* $NetBSD: cpu.c,v 1.44 2000/05/23 05:12:53 thorpej Exp $ */
/*-
@@ -559,7 +559,8 @@ cpu_iccb_send(cpu_id, msg)
* Copy the message into the ICCB, and tell the secondary console
* that it's there. The atomic operation performs a memory barrier.
*/
- strcpy(pcsp->pcs_iccb.iccb_rxbuf, msg);
+ strlcpy(pcsp->pcs_iccb.iccb_rxbuf, msg,
+ sizeof pcsp->pcs_iccb.iccb_rxbuf);
pcsp->pcs_iccb.iccb_rxlen = strlen(msg);
atomic_setbits_ulong(&hwrpb->rpb_rxrdy, cpumask);
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index 637d1597375..e9aff928a7a 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.80 2003/05/10 21:11:11 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.81 2003/05/11 19:41:08 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -385,7 +385,7 @@ nobootinfo:
/* NOTREACHED */
}
(*c->init)();
- strcpy(cpu_model, platform.model);
+ strlcpy(cpu_model, platform.model, sizeof cpu_model);
/*
* Initialize the real console, so that the bootstrap console is
diff --git a/sys/arch/alpha/pci/pci_550.c b/sys/arch/alpha/pci/pci_550.c
index e2814c0a63f..e7046bab335 100644
--- a/sys/arch/alpha/pci/pci_550.c
+++ b/sys/arch/alpha/pci/pci_550.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_550.c,v 1.10 2002/06/25 21:33:21 miod Exp $ */
+/* $OpenBSD: pci_550.c,v 1.11 2003/05/11 19:41:09 deraadt Exp $ */
/* $NetBSD: pci_550.c,v 1.18 2000/06/29 08:58:48 mrg Exp $ */
/*-
@@ -286,7 +286,7 @@ dec_550_intr_string(ccv, ih)
if (ih >= DEC_550_MAX_IRQ)
panic("dec_550_intr_string: bogus 550 IRQ 0x%lx", ih);
- sprintf(irqstr, "dec 550 irq %ld", ih);
+ snprintf(irqstr, sizeof irqstr, "dec 550 irq %ld", ih);
return (irqstr);
}
diff --git a/sys/arch/alpha/pci/sio_pic.c b/sys/arch/alpha/pci/sio_pic.c
index a130ab719b3..b082b42304d 100644
--- a/sys/arch/alpha/pci/sio_pic.c
+++ b/sys/arch/alpha/pci/sio_pic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio_pic.c,v 1.21 2002/06/25 21:33:21 miod Exp $ */
+/* $OpenBSD: sio_pic.c,v 1.22 2003/05/11 19:41:09 deraadt Exp $ */
/* $NetBSD: sio_pic.c,v 1.28 2000/06/06 03:10:13 thorpej Exp $ */
/*-
@@ -441,7 +441,7 @@ sio_intr_string(v, irq)
if (irq == 0 || irq >= ICU_LEN || irq == 2)
panic("sio_intr_string: bogus isa irq 0x%x", irq);
- sprintf(irqstr, "isa irq %d", irq);
+ snprintf(irqstr, sizeof irqstr, "isa irq %d", irq);
return (irqstr);
}
diff --git a/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c b/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c
index 114a7556f11..02381d36ff0 100644
--- a/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c
+++ b/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setnetbootinfo.c,v 1.1 1997/05/05 06:02:03 millert Exp $ */
+/* $OpenBSD: setnetbootinfo.c,v 1.2 2003/05/11 19:41:09 deraadt Exp $ */
/* $NetBSD: setnetbootinfo.c,v 1.5 1997/04/06 08:41:37 cgd Exp $ */
/*
@@ -140,10 +140,13 @@ main(argc, argv)
outfilename = outfile;
else {
/* name + 12 for enet addr + '.' before enet addr + NUL */
- outfilename = malloc(strlen(netboot) + 14);
+ size_t len = strlen(netboot) + 14;
+
+ outfilename = malloc(len);
if (outfilename == NULL)
err(1, "malloc of output file name failed");
- sprintf(outfilename, "%s.%02x%02x%02x%02x%02x%02x", netboot,
+ snprintf(outfilename, len,
+ "%s.%02x%02x%02x%02x%02x%02x", netboot,
ether_addr->ether_addr_octet[0],
ether_addr->ether_addr_octet[1],
ether_addr->ether_addr_octet[2],
diff --git a/sys/arch/hppa/dev/mongoose.c b/sys/arch/hppa/dev/mongoose.c
index c931a8996fe..0dda370bd10 100644
--- a/sys/arch/hppa/dev/mongoose.c
+++ b/sys/arch/hppa/dev/mongoose.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mongoose.c,v 1.11 2003/04/08 20:48:39 mickey Exp $ */
+/* $OpenBSD: mongoose.c,v 1.12 2003/05/11 19:41:09 deraadt Exp $ */
/*
* Copyright (c) 1998,1999 Michael Shalayeff
@@ -238,7 +238,7 @@ mg_intr_string(void *v, int irq)
{
static char buf[16];
- sprintf (buf, "isa irq %d", irq);
+ snprintf(buf, sizeof buf, "isa irq %d", irq);
return buf;
}
diff --git a/sys/arch/hppa/gsc/harmony.c b/sys/arch/hppa/gsc/harmony.c
index 4d08abb6276..54db3632e57 100644
--- a/sys/arch/hppa/gsc/harmony.c
+++ b/sys/arch/hppa/gsc/harmony.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: harmony.c,v 1.17 2003/03/12 09:06:11 mickey Exp $ */
+/* $OpenBSD: harmony.c,v 1.18 2003/05/11 19:41:09 deraadt Exp $ */
/*
* Copyright (c) 2003 Jason L. Wright (jason@thought.net)
@@ -254,7 +254,8 @@ harmony_attach(parent, self, aux)
sc->sc_hasulinear8 = 1;
strlcpy(sc->sc_audev.name, ga->ga_name, sizeof(sc->sc_audev.name));
- sprintf(sc->sc_audev.version, "%u.%u;%u", ga->ga_type.iodc_sv_rev,
+ snprintf(sc->sc_audev.version, sizeof sc->sc_audev.version,
+ "%u.%u;%u", ga->ga_type.iodc_sv_rev,
ga->ga_type.iodc_model, ga->ga_type.iodc_revision);
strlcpy(sc->sc_audev.config, sc->sc_dv.dv_xname,
sizeof(sc->sc_audev.config));
@@ -388,44 +389,44 @@ harmony_query_encoding(void *vsc, struct audio_encoding *fp)
switch (fp->index) {
case 0:
- strcpy(fp->name, AudioEmulaw);
+ strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = 0;
break;
case 1:
- strcpy(fp->name, AudioEalaw);
+ strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = 0;
break;
case 2:
- strcpy(fp->name, AudioEslinear_be);
+ strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = 0;
break;
case 3:
- strcpy(fp->name, AudioEslinear_le);
+ strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
break;
case 4:
- strcpy(fp->name, AudioEulinear_be);
+ strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
break;
case 5:
- strcpy(fp->name, AudioEulinear_le);
+ strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
break;
case 6:
if (sc->sc_hasulinear8) {
- strcpy(fp->name, AudioEulinear);
+ strlcpy(fp->name, AudioEulinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
@@ -434,7 +435,7 @@ harmony_query_encoding(void *vsc, struct audio_encoding *fp)
/*FALLTHROUGH*/
case 7:
if (sc->sc_hasulinear8) {
- strcpy(fp->name, AudioEslinear);
+ strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
@@ -817,95 +818,107 @@ harmony_query_devinfo(void *vsc, mixer_devinfo_t *dip)
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = HARMONY_PORT_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNinput);
+ strlcpy(dip->label.name, AudioNinput, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case HARMONY_PORT_INPUT_OV:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = HARMONY_PORT_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, "overrange");
+ strlcpy(dip->label.name, "overrange", sizeof dip->label.name);
dip->un.e.num_mem = 2;
- strcpy(dip->un.e.member[0].label.name, AudioNoff);
+ strlcpy(dip->un.e.member[0].label.name, AudioNoff,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = 0;
- strcpy(dip->un.e.member[1].label.name, AudioNon);
+ strlcpy(dip->un.e.member[1].label.name, AudioNon,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = 1;
break;
case HARMONY_PORT_OUTPUT_LVL:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = HARMONY_PORT_OUTPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNoutput);
+ strlcpy(dip->label.name, AudioNoutput, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case HARMONY_PORT_OUTPUT_GAIN:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = HARMONY_PORT_OUTPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, "gain");
+ strlcpy(dip->label.name, "gain", sizeof dip->label.name);
dip->un.e.num_mem = 2;
- strcpy(dip->un.e.member[0].label.name, AudioNoff);
+ strlcpy(dip->un.e.member[0].label.name, AudioNoff,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = 0;
- strcpy(dip->un.e.member[1].label.name, AudioNon);
+ strlcpy(dip->un.e.member[1].label.name, AudioNon,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = 1;
break;
case HARMONY_PORT_MONITOR_LVL:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = HARMONY_PORT_MONITOR_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNmonitor);
+ strlcpy(dip->label.name, AudioNmonitor, sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case HARMONY_PORT_RECORD_SOURCE:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = HARMONY_PORT_RECORD_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNsource);
+ strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name);
dip->un.e.num_mem = 2;
- strcpy(dip->un.e.member[0].label.name, AudioNmicrophone);
+ strlcpy(dip->un.e.member[0].label.name, AudioNmicrophone,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = HARMONY_IN_MIC;
- strcpy(dip->un.e.member[1].label.name, AudioNline);
+ strlcpy(dip->un.e.member[1].label.name, AudioNline,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = HARMONY_IN_LINE;
break;
case HARMONY_PORT_OUTPUT_SOURCE:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = HARMONY_PORT_MONITOR_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNoutput);
+ strlcpy(dip->label.name, AudioNoutput, sizeof dip->label.name);
dip->un.e.num_mem = 3;
- strcpy(dip->un.e.member[0].label.name, AudioNline);
+ strlcpy(dip->un.e.member[0].label.name, AudioNline,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = HARMONY_OUT_LINE;
- strcpy(dip->un.e.member[1].label.name, AudioNspeaker);
+ strlcpy(dip->un.e.member[1].label.name, AudioNspeaker,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = HARMONY_OUT_SPEAKER;
- strcpy(dip->un.e.member[2].label.name, AudioNheadphone);
+ strlcpy(dip->un.e.member[2].label.name, AudioNheadphone,
+ sizeof dip->un.e.member[2].label.name);
dip->un.e.member[2].ord = HARMONY_OUT_HEADPHONE;
break;
case HARMONY_PORT_INPUT_CLASS:
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = HARMONY_PORT_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCinputs);
+ strlcpy(dip->label.name, AudioCinputs, sizeof dip->label.name);
break;
case HARMONY_PORT_OUTPUT_CLASS:
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = HARMONY_PORT_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCoutputs);
+ strlcpy(dip->label.name, AudioCoutputs, sizeof dip->label.name);
break;
case HARMONY_PORT_MONITOR_CLASS:
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = HARMONY_PORT_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCmonitor);
+ strlcpy(dip->label.name, AudioCmonitor, sizeof dip->label.name);
break;
case HARMONY_PORT_RECORD_CLASS:
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = HARMONY_PORT_RECORD_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCrecord);
+ strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name);
break;
default:
err = ENXIO;
diff --git a/sys/arch/hppa/hppa/autoconf.c b/sys/arch/hppa/hppa/autoconf.c
index 8e343a021c8..3c1c454585f 100644
--- a/sys/arch/hppa/hppa/autoconf.c
+++ b/sys/arch/hppa/hppa/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.31 2003/04/03 21:41:19 mickey Exp $ */
+/* $OpenBSD: autoconf.c,v 1.32 2003/05/11 19:41:09 deraadt Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -405,7 +405,7 @@ setroot(void)
printf(": ");
len = getstr(buf, sizeof(buf));
if (len == 0 && bootdv != NULL) {
- strcpy(buf, bootdv->dv_xname);
+ strlcpy(buf, bootdv->dv_xname, sizeof buf);
len = strlen(buf);
}
if (len > 0 && buf[len - 1] == '*') {
@@ -722,7 +722,7 @@ hppa_mod_info(type, sv)
(mi->mi_type != type || mi->mi_sv != sv); mi++);
if (mi->mi_type < 0) {
- sprintf(fakeid, "type %x, sv %x", type, sv);
+ snprintf(fakeid, sizeof fakeid, "type %x, sv %x", type, sv);
return fakeid;
} else
return mi->mi_name;
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index 597f9a4aa55..9e01828a49a 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.103 2003/04/07 16:20:38 mickey Exp $ */
+/* $OpenBSD: machdep.c,v 1.104 2003/05/11 19:41:09 deraadt Exp $ */
/*
* Copyright (c) 1999-2002 Michael Shalayeff
@@ -468,7 +468,7 @@ hppa_init(start)
} else {
p = hppa_mod_info(HPPA_TYPE_BOARD, hv);
if (!p) {
- sprintf(buf, "(UNKNOWN 0x%x)", hv);
+ snprintf(buf, sizeof buf, "(UNKNOWN 0x%x)", hv);
p = buf;
}
@@ -501,7 +501,8 @@ hppa_init(start)
}
}
- sprintf(cpu_model, "HP 9000/%s PA-RISC %s%x", p, q, lev);
+ snprintf(cpu_model, sizeof cpu_model,
+ "HP 9000/%s PA-RISC %s%x", p, q, lev);
}
/* we hope this won't fail */
diff --git a/sys/arch/hppa/stand/mkboot/mkboot.c b/sys/arch/hppa/stand/mkboot/mkboot.c
index be86c1ea58a..b82b543c7f9 100644
--- a/sys/arch/hppa/stand/mkboot/mkboot.c
+++ b/sys/arch/hppa/stand/mkboot/mkboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkboot.c,v 1.11 2002/06/11 05:18:22 jsyn Exp $ */
+/* $OpenBSD: mkboot.c,v 1.12 2003/05/11 19:41:09 deraadt Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -43,7 +43,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char rcsid[] = "$OpenBSD: mkboot.c,v 1.11 2002/06/11 05:18:22 jsyn Exp $";
+static char rcsid[] = "$OpenBSD: mkboot.c,v 1.12 2003/05/11 19:41:09 deraadt Exp $";
#endif /* not lint */
#endif
@@ -133,7 +133,7 @@ main(argc, argv)
bzero(buf, sizeof(buf));
/* clear possibly unused directory entries */
- memset(lifd[1].dir_name, ' ', 10);
+ memset(lifd[1].dir_name, ' ', sizeof lifd[1].dir_name);
lifd[1].dir_type = -1;
lifd[1].dir_addr = 0;
lifd[1].dir_length = 0;
@@ -174,7 +174,8 @@ main(argc, argv)
lifd[1].dir_implement = htobe32(loadpoint + entry);
}
- strcpy(lifd[optind].dir_name, lifname(argv[optind]));
+ strlcpy(lifd[optind].dir_name, lifname(argv[optind]),
+ sizeof lifd[optind].dir_name);
lifd[optind].dir_length = htobe32(n);
bcddate(argv[optind], lifd[optind].dir_toc);
lifd[optind].dir_flag = htobe16(LIF_DIR_FLAG);
diff --git a/sys/arch/mac68k/mac68k/autoconf.c b/sys/arch/mac68k/mac68k/autoconf.c
index 2c0ed1f64c8..992dae377e5 100644
--- a/sys/arch/mac68k/mac68k/autoconf.c
+++ b/sys/arch/mac68k/mac68k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.17 2003/02/25 01:45:12 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.18 2003/05/11 19:41:10 deraadt Exp $ */
/* $NetBSD: autoconf.c,v 1.38 1996/12/18 05:46:09 scottr Exp $ */
/*
@@ -282,7 +282,7 @@ setroot(void)
printf(": ");
len = getstr(buf, sizeof(buf));
if (len == 0 && bootdv != NULL) {
- strcpy(buf, bootdv->dv_xname);
+ strlcpy(buf, bootdv->dv_xname, sizeof buf);
len = strlen(buf);
}
if (len == 4 && !strcmp(buf, "halt"))
diff --git a/sys/arch/mac68k/mac68k/pram.c b/sys/arch/mac68k/mac68k/pram.c
index cff3c995fa3..3715d4d653a 100644
--- a/sys/arch/mac68k/mac68k/pram.c
+++ b/sys/arch/mac68k/mac68k/pram.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pram.c,v 1.6 1997/04/14 18:48:06 gene Exp $ */
+/* $OpenBSD: pram.c,v 1.7 2003/05/11 19:41:10 deraadt Exp $ */
/* $NetBSD: pram.c,v 1.11 1996/10/21 05:42:29 scottr Exp $ */
/*-
@@ -120,7 +120,8 @@ static char *convtime(unsigned long t)
t=0;
}
- sprintf(s,"%s %ld, %ld %ld:%ld:%ld",monstr[month],day,year,hour,minute,seconds);
+ snprintf(s, sizeof s, "%s %ld, %ld %ld:%ld:%ld",
+ monstr[month],day,year,hour,minute,seconds);
return s;
}
diff --git a/sys/arch/macppc/dev/awacs.c b/sys/arch/macppc/dev/awacs.c
index 832557c2e53..ff69d3ca884 100644
--- a/sys/arch/macppc/dev/awacs.c
+++ b/sys/arch/macppc/dev/awacs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: awacs.c,v 1.11 2002/09/15 09:01:58 deraadt Exp $ */
+/* $OpenBSD: awacs.c,v 1.12 2003/05/11 19:41:10 deraadt Exp $ */
/* $NetBSD: awacs.c,v 1.4 2001/02/26 21:07:51 wiz Exp $ */
/*-
@@ -503,31 +503,31 @@ awacs_query_encoding(h, ae)
{
switch (ae->index) {
case 0:
- strcpy(ae->name, AudioEslinear);
+ strlcpy(ae->name, AudioEslinear, sizeof ae->name);
ae->encoding = AUDIO_ENCODING_SLINEAR;
ae->precision = 16;
ae->flags = 0;
return 0;
case 1:
- strcpy(ae->name, AudioEslinear_be);
+ strlcpy(ae->name, AudioEslinear_be, sizeof ae->name);
ae->encoding = AUDIO_ENCODING_SLINEAR_BE;
ae->precision = 16;
ae->flags = 0;
return 0;
case 2:
- strcpy(ae->name, AudioEslinear_le);
+ strlcpy(ae->name, AudioEslinear_le, sizeof ae->name);
ae->encoding = AUDIO_ENCODING_SLINEAR_LE;
ae->precision = 16;
ae->flags = 0;
return 0;
case 3:
- strcpy(ae->name, AudioEmulaw);
+ strlcpy(ae->name, AudioEmulaw, sizeof ae->name);
ae->encoding = AUDIO_ENCODING_ULAW;
ae->precision = 8;
ae->flags = AUDIO_ENCODINGFLAG_EMULATED;
return 0;
case 4:
- strcpy(ae->name, AudioEalaw);
+ strlcpy(ae->name, AudioEalaw, sizeof ae->name);
ae->encoding = AUDIO_ENCODING_ALAW;
ae->precision = 8;
ae->flags = AUDIO_ENCODINGFLAG_EMULATED;
@@ -846,74 +846,84 @@ awacs_query_devinfo(h, dip)
case AWACS_OUTPUT_SELECT:
dip->mixer_class = AWACS_MONITOR_CLASS;
- strcpy(dip->label.name, AudioNoutput);
+ strlcpy(dip->label.name, AudioNoutput, sizeof dip->label.name);
dip->type = AUDIO_MIXER_SET;
dip->prev = dip->next = AUDIO_MIXER_LAST;
dip->un.s.num_mem = 2;
- strcpy(dip->un.s.member[0].label.name, AudioNspeaker);
+ strlcpy(dip->un.s.member[0].label.name, AudioNspeaker,
+ sizeof dip->un.s.member[0].label.name);
dip->un.s.member[0].mask = 1 << 0;
- strcpy(dip->un.s.member[1].label.name, AudioNheadphone);
+ strlcpy(dip->un.s.member[1].label.name, AudioNheadphone,
+ sizeof dip->un.s.member[0].label.name);
dip->un.s.member[1].mask = 1 << 1;
return 0;
case AWACS_VOL_SPEAKER:
dip->mixer_class = AWACS_OUTPUT_CLASS;
- strcpy(dip->label.name, AudioNspeaker);
+ strlcpy(dip->label.name, AudioNspeaker,
+ sizeof dip->label.name);
dip->type = AUDIO_MIXER_VALUE;
dip->prev = dip->next = AUDIO_MIXER_LAST;
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
return 0;
case AWACS_VOL_HEADPHONE:
dip->mixer_class = AWACS_OUTPUT_CLASS;
- strcpy(dip->label.name, AudioNheadphone);
+ strlcpy(dip->label.name, AudioNheadphone,
+ sizeof dip->label.name);
dip->type = AUDIO_MIXER_VALUE;
dip->prev = dip->next = AUDIO_MIXER_LAST;
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
return 0;
case AWACS_INPUT_SELECT:
dip->mixer_class = AWACS_RECORD_CLASS;
- strcpy(dip->label.name, AudioNsource);
+ strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name);
dip->type = AUDIO_MIXER_SET;
dip->prev = dip->next = AUDIO_MIXER_LAST;
dip->un.s.num_mem = 3;
- strcpy(dip->un.s.member[0].label.name, AudioNcd);
+ strlcpy(dip->un.s.member[0].label.name, AudioNcd,
+ sizeof dip->un.s.member[0].label.name);
dip->un.s.member[0].mask = 1 << 0;
- strcpy(dip->un.s.member[1].label.name, AudioNmicrophone);
+ strlcpy(dip->un.s.member[1].label.name, AudioNmicrophone,
+ sizeof dip->un.s.member[1].label.name);
dip->un.s.member[1].mask = 1 << 1;
- strcpy(dip->un.s.member[2].label.name, AudioNline);
+ strlcpy(dip->un.s.member[2].label.name, AudioNline,
+ sizeof dip->un.s.member[2].label.name);
dip->un.s.member[2].mask = 1 << 2;
return 0;
case AWACS_VOL_INPUT:
dip->mixer_class = AWACS_RECORD_CLASS;
- strcpy(dip->label.name, AudioNmaster);
+ strlcpy(dip->label.name, AudioNmaster, sizeof dip->label.name);
dip->type = AUDIO_MIXER_VALUE;
dip->prev = dip->next = AUDIO_MIXER_LAST;
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
return 0;
case AWACS_MONITOR_CLASS:
dip->mixer_class = AWACS_MONITOR_CLASS;
- strcpy(dip->label.name, AudioCmonitor);
+ strlcpy(dip->label.name, AudioCmonitor, sizeof dip->label.name);
dip->type = AUDIO_MIXER_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
return 0;
case AWACS_OUTPUT_CLASS:
dip->mixer_class = AWACS_OUTPUT_CLASS;
- strcpy(dip->label.name, AudioCoutputs);
+ strlcpy(dip->label.name, AudioCoutputs, sizeof dip->label.name);
dip->type = AUDIO_MIXER_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
return 0;
case AWACS_RECORD_CLASS:
dip->mixer_class = AWACS_MONITOR_CLASS;
- strcpy(dip->label.name, AudioCrecord);
+ strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name);
dip->type = AUDIO_MIXER_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
return 0;
diff --git a/sys/arch/macppc/dev/pm_direct.c b/sys/arch/macppc/dev/pm_direct.c
index f40b5c7a101..23d4218983b 100644
--- a/sys/arch/macppc/dev/pm_direct.c
+++ b/sys/arch/macppc/dev/pm_direct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pm_direct.c,v 1.9 2002/10/18 03:49:16 drahn Exp $ */
+/* $OpenBSD: pm_direct.c,v 1.10 2003/05/11 19:41:10 deraadt Exp $ */
/* $NetBSD: pm_direct.c,v 1.9 2000/06/08 22:10:46 tsubai Exp $ */
/*
@@ -737,11 +737,12 @@ pm_adb_poweroff()
{
PMData p;
+ bzero(&p, sizeof p);
p.command = PMU_POWER_OFF;
p.num_data = 4;
p.s_buf = p.data;
p.r_buf = p.data;
- strcpy(p.data, "MATT");
+ strlcpy(p.data, "MATT", sizeof p.data);
pmgrop(&p);
}
diff --git a/sys/arch/mvme68k/mvme68k/hpux_machdep.c b/sys/arch/mvme68k/mvme68k/hpux_machdep.c
index f25545d8af7..d0adb8c0c8c 100644
--- a/sys/arch/mvme68k/mvme68k/hpux_machdep.c
+++ b/sys/arch/mvme68k/mvme68k/hpux_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hpux_machdep.c,v 1.9 2003/01/09 22:27:09 miod Exp $ */
+/* $OpenBSD: hpux_machdep.c,v 1.10 2003/05/11 19:41:10 deraadt Exp $ */
/* $NetBSD: hpux_machdep.c,v 1.9 1997/03/16 10:00:45 thorpej Exp $ */
/*
@@ -207,7 +207,8 @@ hpux_cpu_uname(ut)
if (machine_table[i].val == cputype)
break;
- sprintf(ut->machine, "9000/%s", machine_table[i].str);
+ snprintf(ut->machine, sizeof ut->machine, "9000/%s",
+ machine_table[i].str);
}
/*
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
index 399df42ddbc..8e37ce4f836 100644
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ b/sys/arch/mvme88k/mvme88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.100 2003/01/13 20:12:18 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.101 2003/05/11 19:41:11 deraadt Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -418,7 +418,8 @@ void
identifycpu()
{
cpuspeed = getcpuspeed();
- sprintf(cpu_model, "Motorola MVME%x, %dMHz", brdtyp, cpuspeed);
+ snprintf(cpu_model, sizeof cpu_model,
+ "Motorola MVME%x, %dMHz", brdtyp, cpuspeed);
printf("\nModel: %s\n", cpu_model);
}
diff --git a/sys/arch/mvmeppc/dev/cpu.c b/sys/arch/mvmeppc/dev/cpu.c
index 468c7c84a19..9e41aafbb8d 100644
--- a/sys/arch/mvmeppc/dev/cpu.c
+++ b/sys/arch/mvmeppc/dev/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.5 2003/02/11 19:20:26 mickey Exp $ */
+/* $OpenBSD: cpu.c,v 1.6 2003/05/11 19:41:11 deraadt Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -89,40 +89,42 @@ cpuattach(parent, dev, aux)
cpu = pvr >> 16;
switch (cpu) {
case 1:
- sprintf(cpu_model, "601");
+ snprintf(cpu_model, sizeof cpu_model, "601");
break;
case 3:
- sprintf(cpu_model, "603");
+ snprintf(cpu_model, sizeof cpu_model, "603");
break;
case 4:
- sprintf(cpu_model, "604");
+ snprintf(cpu_model, sizeof cpu_model, "604");
break;
case 5:
- sprintf(cpu_model, "602");
+ snprintf(cpu_model, sizeof cpu_model, "602");
break;
case 6:
- sprintf(cpu_model, "603e");
+ snprintf(cpu_model, sizeof cpu_model, "603e");
break;
case 7:
- sprintf(cpu_model, "603ev");
+ snprintf(cpu_model, sizeof cpu_model, "603ev");
break;
case 8:
- sprintf(cpu_model, "750");
+ snprintf(cpu_model, sizeof cpu_model, "750");
break;
case 9:
- sprintf(cpu_model, "604ev");
+ snprintf(cpu_model, sizeof cpu_model, "604ev");
break;
case 12:
- sprintf(cpu_model, "7400(G4)");
+ snprintf(cpu_model, sizeof cpu_model, "7400(G4)");
break;
case 20:
- sprintf(cpu_model, "620");
+ snprintf(cpu_model, sizeof cpu_model, "620");
break;
default:
- sprintf(cpu_model, "Version %x", cpu);
+ snprintf(cpu_model, sizeof cpu_model, "Version %x", cpu);
break;
}
- sprintf(cpu_model + strlen(cpu_model), " (Revision %x)", pvr & 0xffff);
+ snprintf(cpu_model + strlen(cpu_model),
+ sizeof cpu_model - strlen(cpu_model),
+ " (Revision %x)", pvr & 0xffff);
printf(": %s", cpu_model);
/* This should only be executed on openfirmware systems... */
diff --git a/sys/arch/mvmeppc/pci/mpcpcibr.c b/sys/arch/mvmeppc/pci/mpcpcibr.c
index 5a1c960f2d4..20fd5718673 100644
--- a/sys/arch/mvmeppc/pci/mpcpcibr.c
+++ b/sys/arch/mvmeppc/pci/mpcpcibr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpcpcibr.c,v 1.10 2002/06/08 15:50:01 miod Exp $ */
+/* $OpenBSD: mpcpcibr.c,v 1.11 2003/05/11 19:41:11 deraadt Exp $ */
/*
* Copyright (c) 2001 Steve Murphree, Jr.
@@ -520,7 +520,7 @@ mpc_intr_string(lcv, ih)
{
static char str[16];
- sprintf(str, "irq %d", ih);
+ snprintf(str, sizeof str, "irq %d", ih);
return (str);
}
diff --git a/sys/arch/mvmeppc/pci/raven.c b/sys/arch/mvmeppc/pci/raven.c
index adc95808c64..fd823c196d7 100644
--- a/sys/arch/mvmeppc/pci/raven.c
+++ b/sys/arch/mvmeppc/pci/raven.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raven.c,v 1.7 2002/03/14 03:15:58 millert Exp $ */
+/* $OpenBSD: raven.c,v 1.8 2003/05/11 19:41:12 deraadt Exp $ */
/*
* Copyright (c) 2001 Steve Murphree, Jr.
@@ -471,7 +471,7 @@ mpc_intr_string(lcv, ih)
{
static char str[16];
- sprintf(str, "irq %d", ih);
+ snprintf(str, sizeof str, "irq %d", ih);
return(str);
}
diff --git a/sys/arch/sparc/dev/amd7930.c b/sys/arch/sparc/dev/amd7930.c
index 28bed7df5fb..9a72a1a1b3d 100644
--- a/sys/arch/sparc/dev/amd7930.c
+++ b/sys/arch/sparc/dev/amd7930.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amd7930.c,v 1.22 2002/04/30 01:12:28 art Exp $ */
+/* $OpenBSD: amd7930.c,v 1.23 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: amd7930.c,v 1.37 1998/03/30 14:23:40 pk Exp $ */
/*
@@ -403,7 +403,7 @@ amd7930_query_encoding(addr, fp)
{
switch (fp->index) {
case 0:
- strcpy(fp->name, AudioEmulaw);
+ strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = 0;
@@ -680,77 +680,84 @@ amd7930_query_devinfo(addr, dip)
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = SUNAUDIO_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNmicrophone);
+ strlcpy(dip->label.name, AudioNmicrophone, sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case SUNAUDIO_SPEAKER:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = SUNAUDIO_OUTPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNspeaker);
+ strlcpy(dip->label.name, AudioNspeaker, sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case SUNAUDIO_HEADPHONES:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = SUNAUDIO_OUTPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNheadphone);
+ strlcpy(dip->label.name, AudioNheadphone, sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->label.name);
break;
case SUNAUDIO_MONITOR:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = SUNAUDIO_OUTPUT_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNmonitor);
+ strlcpy(dip->label.name, AudioNmonitor, sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->label.name);
break;
case SUNAUDIO_SOURCE:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = SUNAUDIO_RECORD_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNsource);
+ strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name);
dip->un.e.num_mem = 1;
- strcpy(dip->un.e.member[0].label.name, AudioNmicrophone);
+ strlcpy(dip->un.e.member[0].label.name, AudioNmicrophone,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = SUNAUDIO_MIC_PORT;
break;
case SUNAUDIO_OUTPUT:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = SUNAUDIO_MONITOR_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNoutput);
+ strlcpy(dip->label.name, AudioNoutput, sizeof dip->label.name);
dip->un.e.num_mem = 2;
- strcpy(dip->un.e.member[0].label.name, AudioNspeaker);
+ strlcpy(dip->un.e.member[0].label.name, AudioNspeaker,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = SUNAUDIO_SPEAKER;
- strcpy(dip->un.e.member[1].label.name, AudioNheadphone);
+ strlcpy(dip->un.e.member[1].label.name, AudioNheadphone,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[1].ord = SUNAUDIO_HEADPHONES;
break;
case SUNAUDIO_INPUT_CLASS:
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = SUNAUDIO_INPUT_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCinputs);
+ strlcpy(dip->label.name, AudioCinputs, sizeof dip->label.name);
break;
case SUNAUDIO_OUTPUT_CLASS:
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = SUNAUDIO_OUTPUT_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCoutputs);
+ strlcpy(dip->label.name, AudioCoutputs, sizeof dip->label.name);
break;
case SUNAUDIO_RECORD_CLASS:
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = SUNAUDIO_RECORD_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCrecord);
+ strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name);
break;
case SUNAUDIO_MONITOR_CLASS:
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = SUNAUDIO_MONITOR_CLASS;
dip->next = dip->prev = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCmonitor);
+ strlcpy(dip->label.name, AudioCmonitor, sizeof dip->label.name);
break;
default:
return (ENXIO);
diff --git a/sys/arch/sparc/dev/cs4231.c b/sys/arch/sparc/dev/cs4231.c
index 47927c6003f..1b8f639d6dc 100644
--- a/sys/arch/sparc/dev/cs4231.c
+++ b/sys/arch/sparc/dev/cs4231.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cs4231.c,v 1.17 2002/09/11 03:11:22 jason Exp $ */
+/* $OpenBSD: cs4231.c,v 1.18 2003/05/11 19:41:12 deraadt Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -600,55 +600,55 @@ cs4231_query_encoding(addr, fp)
switch (fp->index) {
case 0:
- strcpy(fp->name, AudioEmulaw);
+ strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = 0;
break;
case 1:
- strcpy(fp->name, AudioEalaw);
+ strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = 0;
break;
case 2:
- strcpy(fp->name, AudioEslinear_le);
+ strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
break;
case 3:
- strcpy(fp->name, AudioEulinear);
+ strlcpy(fp->name, AudioEulinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
break;
case 4:
- strcpy(fp->name, AudioEslinear_be);
+ strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = 0;
break;
case 5:
- strcpy(fp->name, AudioEslinear);
+ strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
break;
case 6:
- strcpy(fp->name, AudioEulinear_le);
+ strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
break;
case 7:
- strcpy(fp->name, AudioEulinear_be);
+ strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
break;
case 8:
- strcpy(fp->name, AudioEadpcm);
+ strlcpy(fp->name, AudioEadpcm, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ADPCM;
fp->precision = 8;
fp->flags = 0;
@@ -1266,54 +1266,61 @@ cs4231_query_devinfo(addr, dip)
dip->mixer_class = CSAUDIO_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_MIC_MUTE;
- strcpy(dip->label.name, AudioNmicrophone);
+ strlcpy(dip->label.name, AudioNmicrophone,
+ sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_DAC_LVL: /* dacout */
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = CSAUDIO_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_DAC_MUTE;
- strcpy(dip->label.name, AudioNdac);
+ strlcpy(dip->label.name, AudioNdac, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_LINE_IN_LVL: /* line */
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = CSAUDIO_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_LINE_IN_MUTE;
- strcpy(dip->label.name, AudioNline);
+ strlcpy(dip->label.name, AudioNline, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_CD_LVL: /* cd */
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = CSAUDIO_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_CD_MUTE;
- strcpy(dip->label.name, AudioNcd);
+ strlcpy(dip->label.name, AudioNcd, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_MONITOR_LVL: /* monitor level */
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = CSAUDIO_MONITOR_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_MONITOR_MUTE;
- strcpy(dip->label.name, AudioNmonitor);
+ strlcpy(dip->label.name, AudioNmonitor, sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_OUTPUT_LVL:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = CSAUDIO_OUTPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_OUTPUT_MUTE;
- strcpy(dip->label.name, AudioNoutput);
+ strlcpy(dip->label.name, AudioNoutput, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_LINE_IN_MUTE:
dip->type = AUDIO_MIXER_ENUM;
@@ -1353,11 +1360,13 @@ cs4231_query_devinfo(addr, dip)
goto mute;
mute:
- strcpy(dip->label.name, AudioNmute);
+ strlcpy(dip->label.name, AudioNmute, sizeof dip->label.name);
dip->un.e.num_mem = 2;
- strcpy(dip->un.e.member[0].label.name, AudioNon);
+ strlcpy(dip->un.e.member[0].label.name, AudioNon,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = 0;
- strcpy(dip->un.e.member[1].label.name, AudioNoff);
+ strlcpy(dip->un.e.member[1].label.name, AudioNoff,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = 1;
break;
case CSAUDIO_REC_LVL: /* record level */
@@ -1365,37 +1374,45 @@ cs4231_query_devinfo(addr, dip)
dip->mixer_class = CSAUDIO_RECORD_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_RECORD_SOURCE;
- strcpy(dip->label.name, AudioNrecord);
+ strlcpy(dip->label.name, AudioNrecord, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_RECORD_SOURCE:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = CSAUDIO_RECORD_CLASS;
dip->prev = CSAUDIO_REC_LVL;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNsource);
+ strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name);
dip->un.e.num_mem = 4;
- strcpy(dip->un.e.member[0].label.name, AudioNmicrophone);
+ strlcpy(dip->un.e.member[0].label.name, AudioNmicrophone,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = CSPORT_MICROPHONE;
- strcpy(dip->un.e.member[1].label.name, AudioNline);
+ strlcpy(dip->un.e.member[1].label.name, AudioNline,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = CSPORT_LINEIN;
- strcpy(dip->un.e.member[2].label.name, AudioNcd);
+ strlcpy(dip->un.e.member[2].label.name, AudioNcd,
+ sizeof dip->un.e.member[2].label.name);
dip->un.e.member[2].ord = CSPORT_AUX1;
- strcpy(dip->un.e.member[3].label.name, AudioNdac);
+ strlcpy(dip->un.e.member[3].label.name, AudioNdac,
+ sizeof dip->un.e.member[3].label.name);
dip->un.e.member[3].ord = CSPORT_DAC;
break;
case CSAUDIO_OUTPUT:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = CSAUDIO_MONITOR_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNoutput);
+ strlcpy(dip->label.name, AudioNoutput, sizeof dip->label.name);
dip->un.e.num_mem = 3;
- strcpy(dip->un.e.member[0].label.name, AudioNspeaker);
+ strlcpy(dip->un.e.member[0].label.name, AudioNspeaker,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = CSPORT_SPEAKER;
- strcpy(dip->un.e.member[1].label.name, AudioNline);
+ strlcpy(dip->un.e.member[1].label.name, AudioNline,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = CSPORT_LINEOUT;
- strcpy(dip->un.e.member[2].label.name, AudioNheadphone);
+ strlcpy(dip->un.e.member[2].label.name, AudioNheadphone,
+ sizeof dip->un.e.member[2].label.name);
dip->un.e.member[2].ord = CSPORT_HEADPHONE;
break;
case CSAUDIO_INPUT_CLASS: /* input class descriptor */
@@ -1403,28 +1420,28 @@ cs4231_query_devinfo(addr, dip)
dip->mixer_class = CSAUDIO_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCinputs);
+ strlcpy(dip->label.name, AudioCinputs, sizeof dip->label.name);
break;
case CSAUDIO_OUTPUT_CLASS: /* output class descriptor */
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = CSAUDIO_OUTPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCoutputs);
+ strlcpy(dip->label.name, AudioCoutputs, sizeof dip->label.name);
break;
case CSAUDIO_MONITOR_CLASS: /* monitor class descriptor */
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = CSAUDIO_MONITOR_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCmonitor);
+ strlcpy(dip->label.name, AudioCmonitor, sizeof dip->label.name);
break;
case CSAUDIO_RECORD_CLASS: /* record class descriptor */
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = CSAUDIO_RECORD_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCrecord);
+ strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name);
break;
default:
err = ENXIO;
diff --git a/sys/arch/sparc64/dev/ce4231.c b/sys/arch/sparc64/dev/ce4231.c
index a09ad77b145..cbbe9ebf063 100644
--- a/sys/arch/sparc64/dev/ce4231.c
+++ b/sys/arch/sparc64/dev/ce4231.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ce4231.c,v 1.12 2003/02/17 01:29:19 henric Exp $ */
+/* $OpenBSD: ce4231.c,v 1.13 2003/05/11 19:41:12 deraadt Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -516,55 +516,55 @@ ce4231_query_encoding(addr, fp)
switch (fp->index) {
case 0:
- strcpy(fp->name, AudioEmulaw);
+ strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = 0;
break;
case 1:
- strcpy(fp->name, AudioEalaw);
+ strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = 0;
break;
case 2:
- strcpy(fp->name, AudioEslinear_le);
+ strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
break;
case 3:
- strcpy(fp->name, AudioEulinear);
+ strlcpy(fp->name, AudioEulinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
break;
case 4:
- strcpy(fp->name, AudioEslinear_be);
+ strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = 0;
break;
case 5:
- strcpy(fp->name, AudioEslinear);
+ strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
break;
case 6:
- strcpy(fp->name, AudioEulinear_le);
+ strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
break;
case 7:
- strcpy(fp->name, AudioEulinear_be);
+ strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
break;
case 8:
- strcpy(fp->name, AudioEadpcm);
+ strlcpy(fp->name, AudioEadpcm, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ADPCM;
fp->precision = 8;
fp->flags = 0;
@@ -1135,54 +1135,60 @@ ce4231_query_devinfo(addr, dip)
dip->mixer_class = CSAUDIO_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_MIC_MUTE;
- strcpy(dip->label.name, AudioNmicrophone);
+ strlcpy(dip->label.name, AudioNmicrophone, sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_DAC_LVL: /* dacout */
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = CSAUDIO_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_DAC_MUTE;
- strcpy(dip->label.name, AudioNdac);
+ strlcpy(dip->label.name, AudioNdac, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_LINE_IN_LVL: /* line */
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = CSAUDIO_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_LINE_IN_MUTE;
- strcpy(dip->label.name, AudioNline);
+ strlcpy(dip->label.name, AudioNline, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_CD_LVL: /* cd */
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = CSAUDIO_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_CD_MUTE;
- strcpy(dip->label.name, AudioNcd);
+ strlcpy(dip->label.name, AudioNcd, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_MONITOR_LVL: /* monitor level */
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = CSAUDIO_MONITOR_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_MONITOR_MUTE;
- strcpy(dip->label.name, AudioNmonitor);
+ strlcpy(dip->label.name, AudioNmonitor, sizeof dip->label.name);
dip->un.v.num_channels = 1;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_OUTPUT_LVL:
dip->type = AUDIO_MIXER_VALUE;
dip->mixer_class = CSAUDIO_OUTPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_OUTPUT_MUTE;
- strcpy(dip->label.name, AudioNoutput);
+ strlcpy(dip->label.name, AudioNoutput, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_LINE_IN_MUTE:
dip->type = AUDIO_MIXER_ENUM;
@@ -1222,11 +1228,13 @@ ce4231_query_devinfo(addr, dip)
goto mute;
mute:
- strcpy(dip->label.name, AudioNmute);
+ strlcpy(dip->label.name, AudioNmute, sizeof dip->label.name);
dip->un.e.num_mem = 2;
- strcpy(dip->un.e.member[0].label.name, AudioNon);
+ strlcpy(dip->un.e.member[0].label.name, AudioNon,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = 0;
- strcpy(dip->un.e.member[1].label.name, AudioNoff);
+ strlcpy(dip->un.e.member[1].label.name, AudioNoff,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = 1;
break;
case CSAUDIO_REC_LVL: /* record level */
@@ -1234,37 +1242,45 @@ ce4231_query_devinfo(addr, dip)
dip->mixer_class = CSAUDIO_RECORD_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = CSAUDIO_RECORD_SOURCE;
- strcpy(dip->label.name, AudioNrecord);
+ strlcpy(dip->label.name, AudioNrecord, sizeof dip->label.name);
dip->un.v.num_channels = 2;
- strcpy(dip->un.v.units.name, AudioNvolume);
+ strlcpy(dip->un.v.units.name, AudioNvolume,
+ sizeof dip->un.v.units.name);
break;
case CSAUDIO_RECORD_SOURCE:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = CSAUDIO_RECORD_CLASS;
dip->prev = CSAUDIO_REC_LVL;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNsource);
+ strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name);
dip->un.e.num_mem = 3;
- strcpy(dip->un.e.member[0].label.name, AudioNcd);
+ strlcpy(dip->un.e.member[0].label.name, AudioNcd,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = DAC_IN_PORT;
- strcpy(dip->un.e.member[1].label.name, AudioNmicrophone);
+ strlcpy(dip->un.e.member[1].label.name, AudioNmicrophone,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = MIC_IN_PORT;
- strcpy(dip->un.e.member[2].label.name, AudioNdac);
+ strlcpy(dip->un.e.member[2].label.name, AudioNdac,
+ sizeof dip->un.e.member[2].label.name);
dip->un.e.member[2].ord = AUX1_IN_PORT;
- strcpy(dip->un.e.member[3].label.name, AudioNline);
+ strlcpy(dip->un.e.member[3].label.name, AudioNline,
+ sizeof dip->un.e.member[3].label.name);
dip->un.e.member[3].ord = LINE_IN_PORT;
break;
case CSAUDIO_OUTPUT:
dip->type = AUDIO_MIXER_ENUM;
dip->mixer_class = CSAUDIO_MONITOR_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNoutput);
+ strlcpy(dip->label.name, AudioNoutput, sizeof dip->label.name);
dip->un.e.num_mem = 3;
- strcpy(dip->un.e.member[0].label.name, AudioNspeaker);
+ strlcpy(dip->un.e.member[0].label.name, AudioNspeaker,
+ sizeof dip->un.e.member[0].label.name);
dip->un.e.member[0].ord = CSPORT_SPEAKER;
- strcpy(dip->un.e.member[1].label.name, AudioNline);
+ strlcpy(dip->un.e.member[1].label.name, AudioNline,
+ sizeof dip->un.e.member[1].label.name);
dip->un.e.member[1].ord = CSPORT_LINEOUT;
- strcpy(dip->un.e.member[2].label.name, AudioNheadphone);
+ strlcpy(dip->un.e.member[2].label.name, AudioNheadphone,
+ sizeof dip->un.e.member[2].label.name);
dip->un.e.member[2].ord = CSPORT_HEADPHONE;
break;
case CSAUDIO_INPUT_CLASS: /* input class descriptor */
@@ -1272,28 +1288,28 @@ ce4231_query_devinfo(addr, dip)
dip->mixer_class = CSAUDIO_INPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCinputs);
+ strlcpy(dip->label.name, AudioCinputs, sizeof dip->label.name);
break;
case CSAUDIO_OUTPUT_CLASS: /* output class descriptor */
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = CSAUDIO_OUTPUT_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCoutputs);
+ strlcpy(dip->label.name, AudioCoutputs, sizeof dip->label.name);
break;
case CSAUDIO_MONITOR_CLASS: /* monitor class descriptor */
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = CSAUDIO_MONITOR_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCmonitor);
+ strlcpy(dip->label.name, AudioCmonitor, sizeof dip->label.name);
break;
case CSAUDIO_RECORD_CLASS: /* record class descriptor */
dip->type = AUDIO_MIXER_CLASS;
dip->mixer_class = CSAUDIO_RECORD_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioCrecord);
+ strlcpy(dip->label.name, AudioCrecord, sizeof dip->label.name);
break;
default:
err = ENXIO;
diff --git a/sys/arch/vax/bi/if_ni.c b/sys/arch/vax/bi/if_ni.c
index f8f0123e52e..7795fa1afe9 100644
--- a/sys/arch/vax/bi/if_ni.c
+++ b/sys/arch/vax/bi/if_ni.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ni.c,v 1.3 2002/10/27 13:25:48 miod Exp $ */
+/* $OpenBSD: if_ni.c,v 1.4 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: if_ni.c,v 1.15 2002/05/22 16:03:14 wiz Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -287,7 +287,7 @@ niattach(parent, self, aux)
fqb->nf_dlen = PKTHDR+TXADD;
fqb->nf_rlen = PKTHDR+RXADD;
- 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_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_start = nistart;
diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c
index 2fbf70aeee2..d418ecaa776 100644
--- a/sys/arch/vax/if/if_qe.c
+++ b/sys/arch/vax/if/if_qe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_qe.c,v 1.16 2003/02/05 00:05:15 hugh Exp $ */
+/* $OpenBSD: if_qe.c,v 1.17 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -315,7 +315,7 @@ qeattach(struct device *parent, struct device *self, void *aux)
sc, &sc->sc_intrcnt);
evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt);
- 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_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_start = qestart;
diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c
index a53095fe22b..292bcd12f02 100644
--- a/sys/arch/vax/if/sgec.c
+++ b/sys/arch/vax/if/sgec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sgec.c,v 1.5 2002/10/12 01:09:44 krw Exp $ */
+/* $OpenBSD: sgec.c,v 1.6 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -196,7 +196,7 @@ sgec_attach(sc)
if (zereset(sc))
return;
- 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_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_start = zestart;
diff --git a/sys/arch/vax/include/cpu.h b/sys/arch/vax/include/cpu.h
index 5a85ebad627..24f3111826a 100644
--- a/sys/arch/vax/include/cpu.h
+++ b/sys/arch/vax/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.13 2002/06/12 12:36:13 hugh Exp $ */
+/* $OpenBSD: cpu.h,v 1.14 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: cpu.h,v 1.41 1999/10/21 20:01:36 ragge Exp $ */
/*
@@ -115,6 +115,8 @@ extern int want_resched; /* resched() was called */
struct device;
+extern char cpu_model[100];
+
/* Some low-level prototypes */
int badaddr(caddr_t, int);
void cpu_swapin(struct proc *);
diff --git a/sys/arch/vax/qbus/if_de.c b/sys/arch/vax/qbus/if_de.c
index 03c71f53728..f6ca734e438 100644
--- a/sys/arch/vax/qbus/if_de.c
+++ b/sys/arch/vax/qbus/if_de.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_de.c,v 1.1 2002/06/11 09:36:24 hugh Exp $ */
+/* $OpenBSD: if_de.c,v 1.2 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: if_de.c,v 1.11 2001/11/13 07:11:24 lukem Exp $ */
/*
@@ -239,7 +239,7 @@ deattach(struct device *parent, struct device *self, void *aux)
evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, ua->ua_evcnt,
sc->sc_dev.dv_xname, "intr");
- 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_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI;
ifp->if_ioctl = deioctl;
diff --git a/sys/arch/vax/vax/clock.c b/sys/arch/vax/vax/clock.c
index 217daee4a82..f70d3bf70ff 100644
--- a/sys/arch/vax/vax/clock.c
+++ b/sys/arch/vax/vax/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.14 2002/03/14 01:26:48 millert Exp $ */
+/* $OpenBSD: clock.c,v 1.15 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: clock.c,v 1.35 2000/06/04 06:16:58 matt Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
@@ -181,7 +181,7 @@ cpu_initclocks()
* device for vmstat's sake, until it can be replaced.
*/
static struct device clockdev;
- strcpy(clockdev.dv_xname, "clock");
+ strlcpy(clockdev.dv_xname, "clock", sizeof clockdev.dv_xname);
mtpr(-10000, PR_NICR); /* Load in count register */
mtpr(0x800000d1, PR_ICCS); /* Start clock and enable interrupt */
diff --git a/sys/arch/vax/vax/ka820.c b/sys/arch/vax/vax/ka820.c
index 334450f1849..be2bbdb8f3e 100644
--- a/sys/arch/vax/vax/ka820.c
+++ b/sys/arch/vax/vax/ka820.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka820.c,v 1.9 2002/03/14 03:16:02 millert Exp $ */
+/* $OpenBSD: ka820.c,v 1.10 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: ka820.c,v 1.22 2000/06/04 02:19:27 matt Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -131,7 +131,7 @@ ka820_attach(parent, self, aux)
u_short rev;
rev = bus_space_read_4(ba->ba_iot, ba->ba_ioh, BIREG_DTYPE) >> 16;
- strcpy(cpu_model, "VAX 8200");
+ strlcpy(cpu_model, "VAX 8200", sizeof cpu_model);
cpu_model[6] = rev & 0x8000 ? '5' : '0';
printf(": ka82%c (%s) cpu rev %d, u patch rev %d, sec patch %d\n",
cpu_model[6], mastercpu == ba->ba_nodenr ? "master" : "slave",
diff --git a/sys/arch/vax/vax/rootfil.c b/sys/arch/vax/vax/rootfil.c
index f7f83fa3a80..f6d24559da8 100644
--- a/sys/arch/vax/vax/rootfil.c
+++ b/sys/arch/vax/vax/rootfil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rootfil.c,v 1.14 2002/09/17 02:37:20 hugh Exp $ */
+/* $OpenBSD: rootfil.c,v 1.15 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: rootfil.c,v 1.14 1996/10/13 03:35:58 christos Exp $ */
/*
@@ -140,7 +140,7 @@ setroot()
printf(": ");
len = getstr(buf, sizeof(buf));
if (len == 0 && bootdv != NULL) {
- strcpy(buf, bootdv->dv_xname);
+ strlcpy(buf, bootdv->dv_xname, sizeof buf);
len = strlen(buf);
}
if (len > 0 && buf[len - 1] == '*') {
diff --git a/sys/arch/vax/vax/uvaxII.c b/sys/arch/vax/vax/uvaxII.c
index 74d478dbdd1..84723060357 100644
--- a/sys/arch/vax/vax/uvaxII.c
+++ b/sys/arch/vax/vax/uvaxII.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvaxII.c,v 1.10 2002/03/14 01:26:49 millert Exp $ */
+/* $OpenBSD: uvaxII.c,v 1.11 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: uvaxII.c,v 1.10 1996/10/13 03:36:04 christos Exp $ */
/*-
@@ -81,17 +81,15 @@ uvaxII_conf(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- extern char cpu_model[];
-
switch (cpu_type) {
case VAX_630:
- strcpy(cpu_model,"MicroVAX II");
+ strlcpy(cpu_model,"MicroVAX II", sizeof cpu_model);
break;
case VAX_410:
- strcpy(cpu_model,"MicroVAX 2000");
+ strlcpy(cpu_model,"MicroVAX 2000", sizeof cpu_model);
break;
default:
- strcpy(cpu_model, "MicroVAX 78032/78132");
+ strlcpy(cpu_model, "MicroVAX 78032/78132", sizeof cpu_model);
break;
};
printf(": %s\n", cpu_model);
diff --git a/sys/arch/vax/vsa/hdc9224.c b/sys/arch/vax/vsa/hdc9224.c
index c6b9eb9f6b0..10ae62a3057 100644
--- a/sys/arch/vax/vsa/hdc9224.c
+++ b/sys/arch/vax/vsa/hdc9224.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hdc9224.c,v 1.9 2002/06/08 08:50:26 art Exp $ */
+/* $OpenBSD: hdc9224.c,v 1.10 2003/05/11 19:41:12 deraadt Exp $ */
/* $NetBSD: hdc9224.c,v 1.6 1997/03/15 16:32:22 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
@@ -597,7 +597,7 @@ hdc_printgeom(p)
struct hdgeom *p;
{
char dname[8];
- hdc_mid2str(p->media_id, dname);
+ hdc_mid2str(p->media_id, dname, sizeof dname);
printf("**DiskData** XBNs: %d, DBNs: %d, LBNs: %d, RBNs: %d\n",
p->xbn_count, p->dbn_count, p->lbn_count, p->rbn_count);
@@ -620,6 +620,7 @@ int
hdc_mid2str(media_id, name)
long media_id;
char *name;
+ size_t len;
{
struct { /* For RD32 this struct holds: */
u_long mt:7; /* number in name: 0x20 == 32 */
@@ -632,7 +633,7 @@ hdc_mid2str(media_id, name)
#define MIDCHR(x) (x ? x + '@' : ' ')
- sprintf(name, "%c%c%d", MIDCHR(p->a0), MIDCHR(p->a1), p->mt);
+ snprintf(name, len, "%c%c%d", MIDCHR(p->a0), MIDCHR(p->a1), p->mt);
}
int
@@ -678,7 +679,7 @@ hdc_getdata(hdc, hd, unit)
hp->disklbns = hd->sc_xbn.lbn_count;
hp->blksize = DEV_BSIZE;
hp->diskbytes = hp->disklbns * hp->blksize;
- hdc_mid2str(hd->sc_xbn.media_id, hp->diskname);
+ hdc_mid2str(hd->sc_xbn.media_id, hp->diskname, sizeof hp->diskname);
return (0);
}