linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Input: cyapa - off by on in cyapa_update_fw_store()
@ 2015-01-22  7:48 Dan Carpenter
  2015-01-22 16:21 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-01-22  7:48 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Henrik Rydberg, Dudley Du, Jingoo Han, linux-input,
	kernel-janitors

If "(count == NAME_MAX)" then we could end up putting the NUL terminator
one space beyond the end of the fw_name[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
index 64c6128..58f4f6f 100644
--- a/drivers/input/mouse/cyapa.c
+++ b/drivers/input/mouse/cyapa.c
@@ -1013,7 +1013,7 @@ static ssize_t cyapa_update_fw_store(struct device *dev,
 	char fw_name[NAME_MAX];
 	int ret, error;
 
-	if (count > NAME_MAX) {
+	if (count >= NAME_MAX) {
 		dev_err(dev, "File name too long\n");
 		return -EINVAL;
 	}

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

end of thread, other threads:[~2015-01-22 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-22  7:48 [patch] Input: cyapa - off by on in cyapa_update_fw_store() Dan Carpenter
2015-01-22 16:21 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).