Skip to content

Commit

Permalink
[ALSA] rawmidi: protect against invalid device number in snd_rawmidi_…
Browse files Browse the repository at this point in the history
…info_select()

Modules: RawMidi Midlevel

In snd_rawmidi_info_select(), check that the device identified by the
passed device number actually exists.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
  • Loading branch information
Clemens Ladisch authored and Jaroslav Kysela committed Jan 3, 2006
1 parent ac09a92 commit a106cd3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sound/core/rawmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,8 @@ int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info
if (info->device >= SNDRV_RAWMIDI_DEVICES)
return -ENXIO;
rmidi = snd_rawmidi_devices[card->number * SNDRV_RAWMIDI_DEVICES + info->device];
if (!rmidi)
return -ENXIO;
if (info->stream < 0 || info->stream > 1)
return -EINVAL;
pstr = &rmidi->streams[info->stream];
Expand Down

0 comments on commit a106cd3

Please sign in to comment.