diff mbox

Input: cyapa - off by on in cyapa_update_fw_store()

Message ID 20150122074801.GA11491@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Jan. 22, 2015, 7:48 a.m. UTC
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>

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Dmitry Torokhov Jan. 22, 2015, 4:21 p.m. UTC | #1
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;
>  	}
diff mbox

Patch

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;
 	}