Skip to content

Commit

Permalink
staging: speakup: avoid out-of-range access in synth_init()
Browse files Browse the repository at this point in the history
Check that array index is in-bounds before accessing the synths[] array.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Cc: stable <stable@vger.kernel.org>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Nickolai Zeldovich authored and Greg Kroah-Hartman committed Jan 7, 2013
1 parent 2dcb4a2 commit ae42865
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/speakup/synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down

0 comments on commit ae42865

Please sign in to comment.