提交 a106cd3d 编写于 作者: C Clemens Ladisch 提交者: Jaroslav Kysela

[ALSA] rawmidi: protect against invalid device number in snd_rawmidi_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: NClemens Ladisch <clemens@ladisch.de>
上级 ac09a925
......@@ -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];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册