linux/tools/thermal
Florian Fainelli 602da762f7 tools/thermal/tmon: Fix string truncation warning in optarg copy
GCC warns about possible string truncation with -Wstringop-truncation:

  tmon.c: In function ‘main’:
  tmon.c:233:25: warning: ‘__builtin_strncpy’ specified bound 20 equals
destination size [-Wstringop-truncation]
    233 |                         strncpy(ctrl_cdev, optarg,
	CDEV_NAME_SIZE);
        |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Replace strncpy() with snprintf() to guarantee NUL-termination and
silence the compiler warning.

Fixes: 94f69966fa ("tools/thermal: Introduce tmon, a tool for thermal subsystem")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Link: https://patch.msgid.link/20260929201951.408456-1-florian.fainelli@broadcom.com
2026-10-14 09:45:40 +02:00
..
lib tools: Remove redundant quiet setup 2025-02-18 16:27:43 -03:00
thermal-engine tools/thermal/thermal-engine: Fix format string bug in thermal-engine 2025-11-25 11:00:28 +01:00
thermometer tools/thermal/thermometer: close fd on realloc() failure 2026-07-22 17:43:55 +02:00
tmon tools/thermal/tmon: Fix string truncation warning in optarg copy 2026-10-14 09:45:40 +02:00