mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
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:
|
||
|---|---|---|
| .. | ||
| lib | ||
| thermal-engine | ||
| thermometer | ||
| tmon | ||