summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-03-14 16:52:12 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-03-14 16:52:12 +0000
commitf3bde49e992d458d12a56a406bac24ea22df0af9 (patch)
treec140418abbce6926fce5b732dcd108e67cc3bd0c /sys
parent25dbd028309f13f7cc7665170eb8ab3cea394fbd (diff)
protect from overflows and null derefs in cpu probing; from wd@ics.nara-wu.ac.jp via pr#2457
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/machdep.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index b035da2e2da..c5a0878c987 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.198 2002/03/14 01:26:32 millert Exp $ */
+/* $OpenBSD: machdep.c,v 1.199 2002/03/14 16:52:11 mickey Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -1195,6 +1195,8 @@ identifycpu()
if (family > CPU_MAXFAMILY)
family = CPU_MAXFAMILY;
class = family - 3;
+ if (class > CPUCLASS_686)
+ class = CPUCLASS_686;
modifier = "";
name = "";
token = "";
@@ -1217,8 +1219,11 @@ identifycpu()
name = intel686_cpu_name(model);
} else
name = cpup->cpu_family[i].cpu_models[model];
- if (name == NULL)
+ if (name == NULL) {
name = cpup->cpu_family[i].cpu_models[CPU_DEFMODEL];
+ if (name == NULL)
+ name = "";
+ }
class = cpup->cpu_family[i].cpu_class;
cpu_setup = cpup->cpu_family[i].cpu_setup;
}