From b4810773754fe8371d17b1be49b1c15e8d9d4547 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 22 Jan 2015 08:20:16 -0800 Subject: [PATCH] Input: cyapa - off by one 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. Signed-off-by: Dan Carpenter Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/cyapa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index 64c6128304cf..58f4f6fa4857 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; } -- 2.11.0