Commit 5d71c43a authored by Nickolai Zeldovich's avatar Nickolai Zeldovich Committed by Ben Hutchings

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

commit ae428655 upstream.

Check that array index is in-bounds before accessing the synths[] array.
Signed-off-by: default avatarNickolai Zeldovich <nickolai@csail.mit.edu>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 6c3e9f4a
......@@ -342,7 +342,7 @@ int synth_init(char *synth_name)
mutex_lock(&spk_mutex);
/* 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)
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