Skip to content

Commit

Permalink
Input: cyapa - off by one in cyapa_update_fw_store()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Dan Carpenter authored and Dmitry Torokhov committed Jan 22, 2015
1 parent a535a9f commit b481077
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/input/mouse/cyapa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b481077

Please sign in to comment.