提交 0ef63e48 编写于 作者: G Guenter Roeck

hwmon: (ntc_thermistor) Ensure that data->name string is terminated

Fix Coverity warning: Calling strncpy with a maximum size argument of 20 bytes
on destination array "data->name" of size 20 bytes might leave the destination
string unterminated.

Fix by replacing strncpy() with strlcpy() and by using sizeof() to determine
the maximum string length.
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
Acked-by: NJean Delvare <khali@linux-fr.org>
上级 e2730bea
......@@ -351,7 +351,7 @@ static int __devinit ntc_thermistor_probe(struct platform_device *pdev)
data->dev = &pdev->dev;
data->pdata = pdata;
strncpy(data->name, pdev->id_entry->name, PLATFORM_NAME_SIZE);
strlcpy(data->name, pdev->id_entry->name, sizeof(data->name));
switch (pdev->id_entry->driver_data) {
case TYPE_NCPXXWB473:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册