summaryrefslogtreecommitdiff
path: root/sys/arch/amiga
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-07 03:02:52 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-07 03:02:52 +0000
commitb6f917e38f32ad82988462d315c2cc55cf1bf038 (patch)
tree5cdca187b9174c4ca42772ef5bc06e07679f4f92 /sys/arch/amiga
parent0718e94007d14d484b2502651a72956542b4a5e0 (diff)
fix chrtoblk() so that it returne ENODEV for entries beyond the end of the table
Diffstat (limited to 'sys/arch/amiga')
-rw-r--r--sys/arch/amiga/amiga/conf.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/arch/amiga/amiga/conf.c b/sys/arch/amiga/amiga/conf.c
index 196e24b7750..6b29db09211 100644
--- a/sys/arch/amiga/amiga/conf.c
+++ b/sys/arch/amiga/amiga/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.20 1998/04/26 22:30:57 niklas Exp $ */
+/* $OpenBSD: conf.c,v 1.21 1998/07/07 03:02:30 deraadt Exp $ */
/* $NetBSD: conf.c,v 1.42 1997/01/07 11:35:03 mrg Exp $ */
/*-
@@ -263,11 +263,12 @@ chrtoblk(dev)
{
int blkmaj;
- if (major(dev) >= nchrdev)
- return(NODEV);
- blkmaj = chrtoblktab[major(dev)];
+ if (major(dev) >= MAXDEV ||
+ major(dev) > sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]))
+ return (NODEV);
+ blkmaj = chrtoblktbl[major(dev)];
if (blkmaj == NODEV)
- return(NODEV);
+ return (NODEV);
return (makedev(blkmaj, minor(dev)));
}