public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: speakup: ensure we do not overrun synths array
@ 2016-05-09 22:22 Colin King
  2016-05-09 22:44 ` Samuel Thibault
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2016-05-09 22:22 UTC (permalink / raw)
  To: William Hubbs, Chris Brannon, Kirk Reiser, Samuel Thibault,
	Greg Kroah-Hartman, Amitoj Kaur Chawla, speakup, devel
  Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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>
---
 drivers/staging/speakup/synth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 4f462c3..810a214 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;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-09 22:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-09 22:22 [PATCH] staging: speakup: ensure we do not overrun synths array Colin King
2016-05-09 22:44 ` Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox