summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-05-10 21:11:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-05-10 21:11:15 +0000
commit607ced2a9825cfbbaa96cea1eeeb0ffa4c3a73a9 (patch)
treea0748894e4753ac59df5b3f28ac342b4b8e01e95 /sys/arch
parent3feefc3c4b3f125fc274b71cfe392f9151b9a489 (diff)
string cleaning; ok beck dhartmei
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/autoconf.c13
-rw-r--r--sys/arch/alpha/alpha/db_disasm.c18
-rw-r--r--sys/arch/alpha/alpha/machdep.c4
-rw-r--r--sys/arch/alpha/alpha/trap.c4
-rw-r--r--sys/arch/alpha/pci/pci_eb164.c4
-rw-r--r--sys/arch/alpha/pci/pci_eb64plus.c4
-rw-r--r--sys/arch/alpha/pci/pci_kn20aa.c4
-rw-r--r--sys/arch/hp300/dev/dio.c9
-rw-r--r--sys/arch/hp300/hp300/autoconf.c7
-rw-r--r--sys/arch/sparc/sparc/cpu.c18
-rw-r--r--sys/arch/sparc64/dev/pci_machdep.c4
-rw-r--r--sys/arch/sparc64/sparc64/ofw_machdep.c4
-rw-r--r--sys/arch/vax/vax/db_disasm.c10
13 files changed, 55 insertions, 48 deletions
diff --git a/sys/arch/alpha/alpha/autoconf.c b/sys/arch/alpha/alpha/autoconf.c
index 8720aff8677..e1459f88236 100644
--- a/sys/arch/alpha/alpha/autoconf.c
+++ b/sys/arch/alpha/alpha/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.19 2002/03/14 01:26:26 millert Exp $ */
+/* $OpenBSD: autoconf.c,v 1.20 2003/05/10 21:11:11 deraadt Exp $ */
/* $NetBSD: autoconf.c,v 1.16 1996/11/13 21:13:04 cgd Exp $ */
/*
@@ -302,7 +302,8 @@ setroot()
unit = DISKUNIT(rootdev);
part = DISKPART(rootdev);
- len = sprintf(buf, "%s%d", findblkname(majdev), unit);
+ len = snprintf(buf, sizeof buf, "%s%d",
+ findblkname(majdev), unit);
if (len >= sizeof(buf))
panic("setroot: device name too long");
@@ -427,10 +428,11 @@ gotswap:
rootdevname = findblkname(major(rootdev));
if (rootdevname == NULL) {
/* Root on NFS or unknown device. */
- strcpy(root_device, "??");
+ strlcpy(root_device, "??", sizeof root_device);
} else {
/* Root on known block device. */
- sprintf(root_device, "%s%d%c", rootdevname,
+ snprintf(root_device, sizeof root_device,
+ "%s%d%c", rootdevname,
DISKUNIT(rootdev), DISKPART(rootdev) + 'a');
}
@@ -447,7 +449,8 @@ gotswap:
#endif
case DV_DISK:
mountroot = dk_mountroot;
- sprintf(root_device, "%s%c", rootdv->dv_xname,
+ snprintf(root_device, sizeof root_device,
+ "%s%c", rootdv->dv_xname,
DISKPART(rootdev) + 'a');
printf("root on %s", root_device);
if (nswapdev != NODEV)
diff --git a/sys/arch/alpha/alpha/db_disasm.c b/sys/arch/alpha/alpha/db_disasm.c
index 5e82c406dc5..a9d87c22e55 100644
--- a/sys/arch/alpha/alpha/db_disasm.c
+++ b/sys/arch/alpha/alpha/db_disasm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_disasm.c,v 1.16 2002/05/16 13:01:41 art Exp $ */
+/* $OpenBSD: db_disasm.c,v 1.17 2003/05/10 21:11:11 deraadt Exp $ */
/* $NetBSD: db_disasm.c,v 1.8 2000/05/25 19:57:30 jhawk Exp $ */
/*
@@ -200,7 +200,7 @@ pal_opname(op)
return (pal_op_tbl[i].name);
}
- sprintf(unk, "0x%x", op);
+ snprintf(unk, sizeof unk, "0x%x", op);
return (unk);
}
@@ -256,7 +256,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);
}
@@ -306,7 +306,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);
}
@@ -351,7 +351,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);
}
@@ -375,7 +375,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);
}
@@ -409,7 +409,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);
}
@@ -448,7 +448,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);
}
@@ -468,7 +468,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);
}
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index 1713c846d21..637d1597375 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.79 2002/12/17 23:11:31 millert Exp $ */
+/* $OpenBSD: machdep.c,v 1.80 2003/05/10 21:11:11 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -1038,7 +1038,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);
}
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c
index 040952ddc30..923dcfe9383 100644
--- a/sys/arch/alpha/alpha/trap.c
+++ b/sys/arch/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.39 2003/01/09 22:27:03 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.40 2003/05/10 21:11:11 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@@ -248,7 +248,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;
}
diff --git a/sys/arch/alpha/pci/pci_eb164.c b/sys/arch/alpha/pci/pci_eb164.c
index a26f1bd4e4c..8be7804db6e 100644
--- a/sys/arch/alpha/pci/pci_eb164.c
+++ b/sys/arch/alpha/pci/pci_eb164.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_eb164.c,v 1.14 2002/03/14 03:15:50 millert Exp $ */
+/* $OpenBSD: pci_eb164.c,v 1.15 2003/05/10 21:11:12 deraadt Exp $ */
/* $NetBSD: pci_eb164.c,v 1.27 2000/06/06 00:50:15 thorpej Exp $ */
/*-
@@ -253,7 +253,7 @@ dec_eb164_intr_string(ccv, ih)
if (ih > EB164_MAX_IRQ)
panic("dec_eb164_intr_string: bogus eb164 IRQ 0x%lx", ih);
- sprintf(irqstr, "eb164 irq %ld", ih);
+ snprintf(irqstr, sizeof irqstr, "eb164 irq %ld", ih);
return (irqstr);
}
diff --git a/sys/arch/alpha/pci/pci_eb64plus.c b/sys/arch/alpha/pci/pci_eb64plus.c
index c90d83b3ec8..8589bb87452 100644
--- a/sys/arch/alpha/pci/pci_eb64plus.c
+++ b/sys/arch/alpha/pci/pci_eb64plus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_eb64plus.c,v 1.4 2002/06/25 21:33:21 miod Exp $ */
+/* $OpenBSD: pci_eb64plus.c,v 1.5 2003/05/10 21:11:12 deraadt Exp $ */
/* $NetBSD: pci_eb64plus.c,v 1.10 2001/07/27 00:25:20 thorpej Exp $ */
/*-
@@ -196,7 +196,7 @@ dec_eb64plus_intr_string(acv, ih)
if (ih > EB64PLUS_MAX_IRQ)
panic("dec_eb64plus_intr_string: bogus eb64+ IRQ 0x%lx", ih);
- sprintf(irqstr, "eb64+ irq %ld", ih);
+ snprintf(irqstr, sizeof irqstr, "eb64+ irq %ld", ih);
return (irqstr);
}
diff --git a/sys/arch/alpha/pci/pci_kn20aa.c b/sys/arch/alpha/pci/pci_kn20aa.c
index 51617e4c8db..dec0ee5bd47 100644
--- a/sys/arch/alpha/pci/pci_kn20aa.c
+++ b/sys/arch/alpha/pci/pci_kn20aa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_kn20aa.c,v 1.18 2002/03/14 03:15:50 millert Exp $ */
+/* $OpenBSD: pci_kn20aa.c,v 1.19 2003/05/10 21:11:12 deraadt Exp $ */
/* $NetBSD: pci_kn20aa.c,v 1.21 1996/11/17 02:05:27 cgd Exp $ */
/*
@@ -187,7 +187,7 @@ dec_kn20aa_intr_string(ccv, ih)
if (ih > KN20AA_MAX_IRQ)
panic("dec_kn20aa_intr_string: bogus kn20aa IRQ 0x%x", ih);
- sprintf(irqstr, "kn20aa irq %ld", ih);
+ snprintf(irqstr, sizeof irqstr, "kn20aa irq %ld", ih);
return (irqstr);
}
diff --git a/sys/arch/hp300/dev/dio.c b/sys/arch/hp300/dev/dio.c
index eb4ecaf449b..551ca5e63ff 100644
--- a/sys/arch/hp300/dev/dio.c
+++ b/sys/arch/hp300/dev/dio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dio.c,v 1.7 2002/03/14 01:26:30 millert Exp $ */
+/* $OpenBSD: dio.c,v 1.8 2003/05/10 21:11:12 deraadt Exp $ */
/* $NetBSD: dio.c,v 1.7 1997/05/05 21:00:32 thorpej Exp $ */
/*-
@@ -283,7 +283,7 @@ dio_devinfo(da, buf, buflen)
* consistent/reliable device ids.
*/
if (da->da_scode == 7 && internalhpib) {
- sprintf(buf, DIO_DEVICE_DESC_IHPIB);
+ snprintf(buf, buflen, DIO_DEVICE_DESC_IHPIB);
return (buf);
}
@@ -300,7 +300,8 @@ dio_devinfo(da, buf, buflen)
}
} else {
foundit:
- sprintf(buf, "%s", dio_devdescs[i].dd_desc);
+ snprintf(buf, buflen, "%s",
+ dio_devdescs[i].dd_desc);
return (buf);
}
}
@@ -310,7 +311,7 @@ dio_devinfo(da, buf, buflen)
/*
* Device is unknown. Construct something reasonable.
*/
- sprintf(buf, "device id = 0x%x secid = 0x%x",
+ snprintf(buf, buflen, "device id = 0x%x secid = 0x%x",
da->da_id, da->da_secid);
return (buf);
}
diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c
index c5b8543b5f5..d19e71cb05e 100644
--- a/sys/arch/hp300/hp300/autoconf.c
+++ b/sys/arch/hp300/hp300/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.23 2002/03/14 01:26:30 millert Exp $ */
+/* $OpenBSD: autoconf.c,v 1.24 2003/05/10 21:11:12 deraadt Exp $ */
/* $NetBSD: autoconf.c,v 1.45 1999/04/10 17:31:02 kleink Exp $ */
/*
@@ -579,7 +579,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] == '*') {
@@ -704,7 +704,8 @@ setroot()
return;
}
bzero(buf, sizeof(buf));
- sprintf(buf, "%s%d", rootdevname, DISKUNIT(rootdev));
+ snprintf(buf, sizeof buf, "%s%d", rootdevname,
+ DISKUNIT(rootdev));
for (dv = alldevs.tqh_first; dv != NULL;
dv = dv->dv_list.tqe_next) {
diff --git a/sys/arch/sparc/sparc/cpu.c b/sys/arch/sparc/sparc/cpu.c
index 3dee51da295..cfcea2aa661 100644
--- a/sys/arch/sparc/sparc/cpu.c
+++ b/sys/arch/sparc/sparc/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.38 2002/11/22 23:08:49 deraadt Exp $ */
+/* $OpenBSD: cpu.c,v 1.39 2003/05/10 21:11:14 deraadt Exp $ */
/* $NetBSD: cpu.c,v 1.56 1997/09/15 20:52:36 pk Exp $ */
/*
@@ -95,7 +95,7 @@ struct cfdriver cpu_cd = {
NULL, "cpu", DV_CPU
};
-char *fsrtoname(int, int, int, char *);
+char *fsrtoname(int, int, int, char *, size_t);
void cache_print(struct cpu_softc *);
void cpu_spinup(struct cpu_softc *);
void fpu_init(struct cpu_softc *);
@@ -223,14 +223,14 @@ cpu_attach(parent, self, aux)
fpu_init(sc);
if (foundfpu)
fpuname = fsrtoname(sc->cpu_impl, sc->cpu_vers,
- sc->fpuvers, fpbuf);
+ sc->fpuvers, fpbuf, sizeof fpbuf);
}
/* XXX - multi-processor: take care of `cpu_model' and `foundfpu' */
- sprintf(model, "%s @ %s MHz, %s FPU", sc->cpu_name,
+ snprintf(model, sizeof model, "%s @ %s MHz, %s FPU", sc->cpu_name,
clockfreq(sc->hz), fpuname);
printf(": %s", model);
- sprintf(cpu_model, "%s, %s", mainbus_model, model);
+ snprintf(cpu_model, sizeof cpu_model, "%s, %s", mainbus_model, model);
if (cpu_hotfix[0])
printf("; %s", cpu_hotfix);
@@ -628,7 +628,8 @@ sun4_hotfix(sc)
{
if ((sc->flags & CPUFLG_SUN4CACHEBUG) != 0) {
kvm_uncache((caddr_t)trapbase, 1);
- sprintf(cpu_hotfix, "cache chip bug - trap page uncached");
+ snprintf(cpu_hotfix, sizeof cpu_hotfix,
+ "cache chip bug - trap page uncached");
}
}
@@ -1309,9 +1310,10 @@ static struct info fpu_types[] = {
};
char *
-fsrtoname(impl, vers, fver, buf)
+fsrtoname(impl, vers, fver, buf, buflen)
register int impl, vers, fver;
char *buf;
+ size_t buflen;
{
register struct info *p;
@@ -1320,7 +1322,7 @@ fsrtoname(impl, vers, fver, buf)
(p->iu_vers == vers || p->iu_vers == ANY) &&
(p->fpu_vers == fver))
return (p->name);
- sprintf(buf, "version 0x%x", fver);
+ snprintf(buf, buflen, "version 0x%x", fver);
return (buf);
}
diff --git a/sys/arch/sparc64/dev/pci_machdep.c b/sys/arch/sparc64/dev/pci_machdep.c
index 2b2088390b3..8e48222337e 100644
--- a/sys/arch/sparc64/dev/pci_machdep.c
+++ b/sys/arch/sparc64/dev/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.c,v 1.11 2003/02/17 01:29:20 henric Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.12 2003/05/10 21:11:14 deraadt Exp $ */
/* $NetBSD: pci_machdep.c,v 1.22 2001/07/20 00:07:13 eeh Exp $ */
/*
@@ -426,7 +426,7 @@ pci_intr_string(pc, ih)
static char str[16];
DPRINTF(SPDB_INTR, ("pci_intr_string: ih %u", ih));
- sprintf(str, "ivec %x", ih);
+ snprintf(str, sizeof str, "ivec %x", ih);
DPRINTF(SPDB_INTR, ("; returning %s\n", str));
return (str);
diff --git a/sys/arch/sparc64/sparc64/ofw_machdep.c b/sys/arch/sparc64/sparc64/ofw_machdep.c
index 89dd792aef4..6af783d3539 100644
--- a/sys/arch/sparc64/sparc64/ofw_machdep.c
+++ b/sys/arch/sparc64/sparc64/ofw_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_machdep.c,v 1.7 2003/01/30 07:53:58 henric Exp $ */
+/* $OpenBSD: ofw_machdep.c,v 1.8 2003/05/10 21:11:14 deraadt Exp $ */
/* $NetBSD: ofw_machdep.c,v 1.16 2001/07/20 00:07:14 eeh Exp $ */
/*
@@ -599,7 +599,7 @@ prom_printf(const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- len = vsprintf(buf, fmt, ap);
+ len = vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
OF_write(OF_stdout(), buf, len);
diff --git a/sys/arch/vax/vax/db_disasm.c b/sys/arch/vax/vax/db_disasm.c
index 390103e00a5..648635c76f8 100644
--- a/sys/arch/vax/vax/db_disasm.c
+++ b/sys/arch/vax/vax/db_disasm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_disasm.c,v 1.11 2002/05/16 07:37:44 miod Exp $ */
+/* $OpenBSD: db_disasm.c,v 1.12 2003/05/10 21:11:14 deraadt Exp $ */
/* $NetBSD: db_disasm.c,v 1.10 1998/04/13 12:10:27 ragge Exp $ */
/*
* Copyright (c) 2002, Miodrag Vallat.
@@ -317,7 +317,7 @@ get_operand(ib, size)
break;
case 4: /* indexed */
- sprintf(buf, "[%s]", my_db_regs[reg].name);
+ snprintf(buf, sizeof buf, "[%s]", my_db_regs[reg].name);
get_operand(ib, 0);
add_str(ib, buf);
break;
@@ -495,9 +495,9 @@ add_int(ib, i)
char buf[32];
if (i < 100 && i > -100)
- sprintf(buf, "%d", i);
+ snprintf(buf, sizeof buf, "%d", i);
else
- sprintf(buf, "0x%x", i);
+ snprintf(buf, sizeof buf, "0x%x", i);
add_str(ib, buf);
}
@@ -508,7 +508,7 @@ add_xint(ib, val)
{
char buf[32];
- sprintf(buf, "0x%x", val);
+ snprintf(buf, sizeof buf, "0x%x", val);
add_str(ib, buf);
}