提交 f87deada 编写于 作者: G Gavin Schenk 提交者: Greg Kroah-Hartman

siox: fix possible buffer overflow in device_add_store

Width 20 given in format string is larger than destination
buffer 'type[20]', use %19s to prevent overflowing it.

Fixes: bbecb07f ("siox: new driver framework for eckelmann SIOX")
Cc: stable <stable@vger.kernel.org>
Reported-by: NDavid Binderman <dcb314@hotmail.com>
Signed-off-by: NGavin Schenk <g.schenk@eckelmann.de>
Reviewed-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 3ba9faed
...@@ -594,7 +594,7 @@ static ssize_t device_add_store(struct device *dev, ...@@ -594,7 +594,7 @@ static ssize_t device_add_store(struct device *dev,
size_t inbytes = 0, outbytes = 0; size_t inbytes = 0, outbytes = 0;
u8 statustype = 0; u8 statustype = 0;
ret = sscanf(buf, "%20s %zu %zu %hhu", type, &inbytes, ret = sscanf(buf, "%19s %zu %zu %hhu", type, &inbytes,
&outbytes, &statustype); &outbytes, &statustype);
if (ret != 3 && ret != 4) if (ret != 3 && ret != 4)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册