From a92485cbaca698673d223c798fdd1e66a54101fd Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 14 Oct 1994 16:37:58 +0000 Subject: Fix range checking bug, pointed by peter@haywire.dialix.com --- sys/dev/speaker/spkr.c | 6 +++--- sys/i386/isa/spkr.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sys') diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index 4f9f2fa..aff7052 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -4,7 +4,7 @@ * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993 * modified for FreeBSD by Andrew A. Chernov * - * $Id: spkr.c,v 1.8 1994/04/21 14:21:50 sos Exp $ + * $Id: spkr.c,v 1.9 1994/08/13 03:50:14 wollman Exp $ */ #include "speaker.h" @@ -329,14 +329,14 @@ size_t slen; else { GETNUM(cp, octave); - if (octave >= sizeof(pitchtab) / OCTAVE_NOTES) + if (octave >= sizeof(pitchtab) / sizeof(pitchtab[0]) / OCTAVE_NOTES) octave = DFLT_OCTAVE; octprefix = TRUE; } break; case '>': - if (octave < sizeof(pitchtab) / OCTAVE_NOTES - 1) + if (octave < sizeof(pitchtab) / sizeof(pitchtab[0]) / OCTAVE_NOTES - 1) octave++; octprefix = TRUE; break; diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index 4f9f2fa..aff7052 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -4,7 +4,7 @@ * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993 * modified for FreeBSD by Andrew A. Chernov * - * $Id: spkr.c,v 1.8 1994/04/21 14:21:50 sos Exp $ + * $Id: spkr.c,v 1.9 1994/08/13 03:50:14 wollman Exp $ */ #include "speaker.h" @@ -329,14 +329,14 @@ size_t slen; else { GETNUM(cp, octave); - if (octave >= sizeof(pitchtab) / OCTAVE_NOTES) + if (octave >= sizeof(pitchtab) / sizeof(pitchtab[0]) / OCTAVE_NOTES) octave = DFLT_OCTAVE; octprefix = TRUE; } break; case '>': - if (octave < sizeof(pitchtab) / OCTAVE_NOTES - 1) + if (octave < sizeof(pitchtab) / sizeof(pitchtab[0]) / OCTAVE_NOTES - 1) octave++; octprefix = TRUE; break; -- cgit v1.1