Input: cyapa - off by one in cyapa_update_fw_store()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 22 Jan 2015 16:20:16 +0000 (08:20 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 22 Jan 2015 16:23:15 +0000 (08:23 -0800)
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>
drivers/input/mouse/cyapa.c

index 64c6128304cf4ba97177415a3228e4477b9e42e5..58f4f6fa4857c34eb6a831154f039e063653992a 100644 (file)
@@ -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;
        }