Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Oct 2018 08:55:58 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339581 - head/sys/dev/sound/midi
Message-ID:  <201810220855.w9M8twJM038901@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Mon Oct 22 08:55:58 2018
New Revision: 339581
URL: https://svnweb.freebsd.org/changeset/base/339581

Log:
  Fix off-by-one which can lead to panics.
  
  Found by:		Peter Holm <peter@holm.cc>
  MFC after:		3 days
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/dev/sound/midi/sequencer.c

Modified: head/sys/dev/sound/midi/sequencer.c
==============================================================================
--- head/sys/dev/sound/midi/sequencer.c	Mon Oct 22 07:04:44 2018	(r339580)
+++ head/sys/dev/sound/midi/sequencer.c	Mon Oct 22 08:55:58 2018	(r339581)
@@ -730,7 +730,7 @@ static int
 seq_fetch_mid(struct seq_softc *scp, int unit, kobj_t *md)
 {
 
-	if (unit > scp->midi_number || unit < 0)
+	if (unit >= scp->midi_number || unit < 0)
 		return EINVAL;
 
 	*md = scp->midis[unit];



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810220855.w9M8twJM038901>