NetBSD Problem Report #6583
Received: (qmail 20582 invoked from network); 15 Dec 1998 12:21:03 -0000
Message-Id: <199812151220.EAA27985@nooksack.ldc.cs.wwu.edu>
Date: Tue, 15 Dec 1998 04:20:38 -0800 (PST)
From: ljocha@ics.muni.cz
To: gnats-bugs@gnats.netbsd.org
Subject: buffer overflow and size handling error in midi buffer
X-Send-Pr-Version: www-1.0
>Number: 6583
>Category: kern
>Synopsis: buffer overflow and size handling error in midi buffer
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Dec 15 04:35:00 +0000 1998
>Closed-Date: Tue Dec 15 17:35:06 +0000 1998
>Last-Modified: Tue Dec 15 17:37:15 +0000 1998
>Originator: Ales Krenek
>Release: NetBSD-current
>Organization:
Masaryk University
>Environment:
>Description:
when the midi output buffer is to cycle in midi_writebytes there is an
overflow and the number of bytes written is handled incorrectly mainly
putting the sequencer code out of sync.
>How-To-Repeat:
write more than MIDI_BUFSIZE midi bytes through /dev/sequencer
>Fix:
*** midi.c.orig Wed Dec 9 12:01:02 1998
--- midi.c Fri Dec 11 10:20:38 1998
***************
*** 597,602 ****
--- 597,603 ----
int n, s;
DPRINTFN(2, ("midi_writebytes: %p, unit=%d, cc=%d\n", sc, unit, cc));
+ DPRINTFN(3, ("midi_writebytes: %x %x %x\n",buf[0],buf[1],buf[2]));
s = splaudio();
if (mb->used + cc >= mb->usedhigh) {
***************
*** 606,612 ****
n = mb->end - mb->inp;
if (cc < n)
n = cc;
! memcpy(mb->inp, buf, cc);
mb->inp += n;
if (mb->inp >= mb->end) {
mb->inp = mb->start;
--- 607,614 ----
n = mb->end - mb->inp;
if (cc < n)
n = cc;
! mb->used += cc;
! memcpy(mb->inp, buf, n);
mb->inp += n;
if (mb->inp >= mb->end) {
mb->inp = mb->start;
***************
*** 616,622 ****
mb->inp += cc;
}
}
- mb->used += cc;
splx(s);
return (midi_start_output(sc, 0));
}
--- 618,623 ----
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: augustss
State-Changed-When: Tue Dec 15 09:35:06 PST 1998
State-Changed-Why:
APatch applied.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.