Skip to contentSkip to conversation

Input: cyapa - off by on in cyapa_update_fw_store()

PATCH Applied Dan Carpenter 2 participants 2 messages Jan 22, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: cyapa - off by on in cyapa_update_fw_store()

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

drivers/input/mouse/cyapa.c +1 -1
index 64c6128..58f4f6f 100644
@@ -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;
 	}
maintainer Applied
#1 lore raw
Quoted 4 lines · Dan Carpenter

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

Applied, thank you.

Quoted 14 lines
drivers/input/mouse/cyapa.c +1 -1
index 64c6128..58f4f6f 100644
@@ -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;
 	}
Signature · 1 line
Dmitry