Commit ae428655 authored by Nickolai Zeldovich's avatar Nickolai Zeldovich Committed by Greg Kroah-Hartman

staging: speakup: avoid out-of-range access in synth_init()

Check that array index is in-bounds before accessing the synths[] array.
Signed-off-by: default avatarNickolai Zeldovich <nickolai@csail.mit.edu>
Cc: stable <stable@vger.kernel.org>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2dcb4a29
...@@ -342,7 +342,7 @@ int synth_init(char *synth_name) ...@@ -342,7 +342,7 @@ int synth_init(char *synth_name)
mutex_lock(&spk_mutex); mutex_lock(&spk_mutex);
/* First, check if we already have it loaded. */ /* First, check if we already have it loaded. */
for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++) for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
if (strcmp(synths[i]->name, synth_name) == 0) if (strcmp(synths[i]->name, synth_name) == 0)
synth = synths[i]; synth = synths[i];
......
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