summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2000-09-29 23:23:38 +0000
committermiod <miod@openbsd.org>2000-09-29 23:23:38 +0000
commit2b2858d6e921dbd6a02c1571f9194a24d8bb7c95 (patch)
tree5a58cd83c646d1f68415d1d57cf363dd568af5f5
parentfix pasto in error printf (diff)
downloadwireguard-openbsd-2b2858d6e921dbd6a02c1571f9194a24d8bb7c95.tar.xz
wireguard-openbsd-2b2858d6e921dbd6a02c1571f9194a24d8bb7c95.zip
Check N command operand value to prevent a panic with large values.
Problem found by Thomas Coffy <karma@bsdfr.org>
-rw-r--r--sys/dev/isa/spkr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/isa/spkr.c b/sys/dev/isa/spkr.c
index d1d28e6aad6..7d09e5b4914 100644
--- a/sys/dev/isa/spkr.c
+++ b/sys/dev/isa/spkr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spkr.c,v 1.2 1999/01/02 00:58:12 niklas Exp $ */
+/* $OpenBSD: spkr.c,v 1.3 2000/09/29 23:23:38 miod Exp $ */
/* $NetBSD: spkr.c,v 1.1 1998/04/15 20:26:18 drochner Exp $ */
/*
@@ -172,7 +172,7 @@ playtone(pitch, value, sustain)
if (pitch == -1)
rest(whole * snum / (value * sdenom));
- else
+ else if (pitch >= 0 && pitch < sizeof(pitchtab))
{
sound = (whole * snum) / (value * sdenom)
- (whole * (FILLTIME - fill)) / (value * FILLTIME);