csize/ssize grew from config-supplied channel indices with no upper
bound before malloc(csize * ssize * sizeof(entry)). Cap both at 1024,
consistent with other PCM plugins.
[ fixed coding style -- tiwai ]
Closes: https://github.com/alsa-project/alsa-lib/pull/527
Signed-off-by: Harsh Raj Singhania <raj.harshraut@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
}
if (cchannel + 1 > csize)
csize = cchannel + 1;
+ if (csize > 1024) {
+ SNDERR("route: client channel %d exceeds max (1024)",
+ cchannel);
+ return -EINVAL;
+ }
if (snd_config_get_type(in) != SND_CONFIG_TYPE_COMPOUND)
return -EINVAL;
snd_config_for_each(j, jnext, in) {
}
if (schannel + 1 > ssize)
ssize = schannel + 1;
+ if (ssize > 1024) {
+ SNDERR("route: slave channel %d exceeds max (1024)",
+ schannel);
+ return -EINVAL;
+ }
}
}
if (csize == 0 || ssize == 0) {