hwmon: (pmbus/max20730) use scnprintf() instead of snprintf()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 22 Oct 2020 07:08:24 +0000 (10:08 +0300)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 26 Oct 2020 15:00:32 +0000 (08:00 -0700)
commit402dab548d0da38b260f3843225cdfd37d91f512
tree3eb1cfdec5cace3462e184e99ce9a9ac4013bc60
parent3650b228f83adda7e5ee532e2b90429c03f7b9ec
hwmon: (pmbus/max20730) use scnprintf() instead of snprintf()

The snprintf() function returns the number of characters which would
have been printed if there were enough space, but the scnprintf()
returns the number of characters which were actually printed.  If the
buffer is not large enough, then using snprintf() would result in a
read overflow and an information leak.

Fixes: 8910c0bd533d ("hwmon: (pmbus/max20730) add device monitoring via debugfs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20201022070824.GC2817762@mwanda
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/max20730.c