From: Dan Carpenter Date: Thu, 22 Jan 2015 16:20:16 +0000 (-0800) Subject: Input: cyapa - off by one in cyapa_update_fw_store() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b4810773754fe8371d17b1be49b1c15e8d9d4547;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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; }