summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDeanna Phillips <deanna@cvs.openbsd.org>2007-11-23 18:34:01 +0000
committerDeanna Phillips <deanna@cvs.openbsd.org>2007-11-23 18:34:01 +0000
commitcda95226eb12b6c92217d2fc52a6093104f2e129 (patch)
treebd689bd993d9855cdaeff94f7795520b41914238 /sys
parent5cd805ff3b1d0280f963cb1e1a1a0436bc3c05f5 (diff)
Check for invalid dev indices, which could get here through ioctl.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/azalia.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c
index fa675b09e9e..e4d9c54173f 100644
--- a/sys/dev/pci/azalia.c
+++ b/sys/dev/pci/azalia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.c,v 1.43 2007/11/16 20:36:25 deanna Exp $ */
+/* $OpenBSD: azalia.c,v 1.44 2007/11/23 18:34:00 deanna Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@@ -2294,6 +2294,8 @@ azalia_set_port(void *v, mixer_ctrl_t *mc)
az = v;
co = &az->codecs[az->codecno];
+ if (mc->dev < 0 || mc->dev > co->nmixers)
+ return EINVAL;
return co->set_port(co, mc);
}
@@ -2305,6 +2307,8 @@ azalia_get_port(void *v, mixer_ctrl_t *mc)
az = v;
co = &az->codecs[az->codecno];
+ if (mc->dev < 0 || mc->dev > co->nmixers)
+ return EINVAL;
return co->get_port(co, mc);
}
@@ -2316,7 +2320,7 @@ azalia_query_devinfo(void *v, mixer_devinfo_t *mdev)
az = v;
co = &az->codecs[az->codecno];
- if (mdev->index >= co->nmixers)
+ if (mdev->index < 0 || mdev->index >= co->nmixers)
return ENXIO;
*mdev = co->mixers[mdev->index].devinfo;
return 0;