aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/speakup/synth.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-05-09 23:22:14 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-15 19:14:54 +0200
commit99a9ffacc1d390e9548b2370beb816c6739b84b2 (patch)
tree6d3c80b5a05d986e90d9804babe1b15fdfae075b /drivers/staging/speakup/synth.c
parentStaging: speakup: Remove space after cast (diff)
downloadlinux-dev-99a9ffacc1d390e9548b2370beb816c6739b84b2.tar.xz
linux-dev-99a9ffacc1d390e9548b2370beb816c6739b84b2.zip
staging: speakup: ensure we do not overrun synths array
synth_add allows one to add MAXSYNTHS synths to the synths array; however it always NULLifies the next synth in the array which means that on the MAXSYNTHS synth we get an out-of-bounds write of the NULL to the synths array. Make the synths array MAXSYNTHS + 1 elements in size to allow for the final NULL sentinal to avoid the out-of-bounds write. Issue found wit CoverityScan, CID#744671 Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/speakup/synth.c')
-rw-r--r--drivers/staging/speakup/synth.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 4f462c35fdd9..810a21408715 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -18,7 +18,7 @@
#include "serialio.h"
#define MAXSYNTHS 16 /* Max number of synths in array. */
-static struct spk_synth *synths[MAXSYNTHS];
+static struct spk_synth *synths[MAXSYNTHS + 1];
struct spk_synth *synth;
char spk_pitch_buff[32] = "";
static int module_status;