Skip to content

Commit 0ef63e4

Browse files
committed
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: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
1 parent e2730be commit 0ef63e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hwmon/ntc_thermistor.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static int __devinit ntc_thermistor_probe(struct platform_device *pdev)
351351

352352
data->dev = &pdev->dev;
353353
data->pdata = pdata;
354-
strncpy(data->name, pdev->id_entry->name, PLATFORM_NAME_SIZE);
354+
strlcpy(data->name, pdev->id_entry->name, sizeof(data->name));
355355

356356
switch (pdev->id_entry->driver_data) {
357357
case TYPE_NCPXXWB473:

0 commit comments

Comments
 (0)