Skip to contentSkip to conversation

ALSA: seq: oss: Fix missing error check in snd_seq_oss_synth_make_info()

PATCH New Takashi Iwai 1 participant 1 message Jan 15, 2021 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: seq: oss: Fix missing error check in snd_seq_oss_synth_make_info()

snd_seq_oss_synth_make_info() didn't check the error code from snd_seq_oss_midi_make_info(), and this leads to the call of strlcpy() with the uninitialized string as the source, which may lead to the access over the limit.

Add the proper error check for avoiding the failure.

---
 sound/core/seq/oss/seq_oss_synth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/seq/oss/seq_oss_synth.c +2 -1
index 11554d0412f0..1b8409ec2c97 100644
@@ -611,7 +611,8 @@ snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_in
 
 	if (info->is_midi) {
 		struct midi_info minf;
-		snd_seq_oss_midi_make_info(dp, info->midi_mapped, &minf);
+		if (snd_seq_oss_midi_make_info(dp, info->midi_mapped, &minf))
+			return -ENXIO;
 		inf->synth_type = SYNTH_TYPE_MIDI;
 		inf->synth_subtype = 0;
 		inf->nr_voices = 16;
Signature · 1 line
2.26.2