diff options
author | 2004-11-20 01:29:37 +0000 | |
---|---|---|
committer | 2004-11-20 01:29:37 +0000 | |
commit | de579f774e4f477f901e886bafdd446dfed87b01 (patch) | |
tree | 4ce0ba96b21cead4456135c1e499c23d99140951 | |
parent | regen (diff) | |
download | wireguard-openbsd-de579f774e4f477f901e886bafdd446dfed87b01.tar.xz wireguard-openbsd-de579f774e4f477f901e886bafdd446dfed87b01.zip |
When processing sysex stop bytes ensure the packet is not corrupted
if we are building a new packet, from Alexandre Ratchov.
ok deraadt@
-rw-r--r-- | sys/dev/usb/umidi.c | 4 |
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; |