* [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
* Re: [patch] Input: cyapa - off by on in cyapa_update_fw_store()
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
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2015-01-22 16:21 UTC (permalink / raw)
To: Dan Carpenter
Cc: Henrik Rydberg, Dudley Du, Jingoo Han, linux-input,
kernel-janitors
On Thu, Jan 22, 2015 at 10:48:01AM +0300, Dan Carpenter wrote:
> 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>
Applied, thank you.
>
> 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;
> }
--
Dmitry
^ permalink raw reply [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).