summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2004-11-20 01:29:38 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2004-11-20 01:29:38 +0000
commit5eb2ede8594aa9b63fbd46989018ebdc5d488480 (patch)
tree02db5805cd472e88eaafc81f6a0a02ff50d5e9ee /sys/dev/usb
parent87ad0363d55d7d1aa5936aba32d64d5ed3b65944 (diff)
When processing sysex stop bytes ensure the packet is not corrupted
if we are building a new packet, from Alexandre Ratchov. ok deraadt@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/umidi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/usb/umidi.c b/sys/dev/usb/umidi.c
index 9188f8fb55d..bb029470c63 100644
--- a/sys/dev/usb/umidi.c
+++ b/sys/dev/usb/umidi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umidi.c,v 1.10 2004/06/27 19:44:48 deraadt Exp $ */
+/* $OpenBSD: umidi.c,v 1.11 2004/11/20 01:29:37 jsg Exp $ */
/* $NetBSD: umidi.c,v 1.16 2002/07/11 21:14:32 augustss Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -1279,6 +1279,8 @@ out_build_packet(int cable_number, struct umidi_packet *packet, uByte data)
break;
case EV_SYSEX_STOP:
if (packet->status != EV_SYSEX) break;
+ if (packet->index == 0)
+ packet->index = 1;
packet->status = data;
packet->buffer[packet->index++] = data;
packet->buffer[0] = (0x4 - 1 + packet->index) | cable_number << 4;