Commit 7f0d5053 authored by Dan Carpenter's avatar Dan Carpenter Committed by Takashi Iwai

ALSA: isa/wavefront: prevent out of bounds write in ioctl

The "header->number" comes from the ioctl and it needs to be clamped to
prevent out of bounds writes.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200501094011.GA960082@mwandaSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0127f597
......@@ -1172,6 +1172,9 @@ wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header)
header->number,
header->hdr.a.OriginalSample);
if (header->number >= WF_MAX_SAMPLE)
return -EINVAL;
munge_int32 (header->number, &alias_hdr[0], 2);
munge_int32 (header->hdr.a.OriginalSample, &alias_hdr[2], 2);
munge_int32 (*((unsigned int *)&header->hdr.a.sampleStartOffset),
......@@ -1202,6 +1205,9 @@ wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header)
int num_samples;
unsigned char *msample_hdr;
if (header->number >= WF_MAX_SAMPLE)
return -EINVAL;
msample_hdr = kmalloc(WF_MSAMPLE_BYTES, GFP_KERNEL);
if (! msample_hdr)
return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment