Skip to content

Commit b8800d3

Browse files
artemetiwai
authored andcommittedDec 26, 2022
ALSA: line6: fix stack overflow in line6_midi_transmit
Correctly calculate available space including the size of the chunk buffer. This fixes a buffer overflow when multiple MIDI sysex messages are sent to a PODxt device. Signed-off-by: Artem Egorkine <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 8508fa2 commit b8800d3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎sound/usb/line6/midi.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ static void line6_midi_transmit(struct snd_rawmidi_substream *substream)
4444
int req, done;
4545

4646
for (;;) {
47-
req = min(line6_midibuf_bytes_free(mb), line6->max_packet_size);
47+
req = min3(line6_midibuf_bytes_free(mb), line6->max_packet_size,
48+
LINE6_FALLBACK_MAXPACKETSIZE);
4849
done = snd_rawmidi_transmit_peek(substream, chunk, req);
4950

5051
if (done == 0)

0 commit comments

Comments
 (0)
Please sign in to comment.