]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitc5540c90f7c82b71e111b54fd600168271eb4e65
tree3eb1cfdec5cace3462e184e99ce9a9ac4013bc60
parenta1fe7c755400af92f0070a66f48f00b659aeacac
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: 96e9993225ad ("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