linux-stable/tools
Florian Fainelli 235b2eadba tools/thermal: Fix possible path truncations
[ Upstream commit 6c58cf40e3 ]

A build with -D_FORTIFY_SOURCE=2 enabled will produce the following warnings:

sysfs.c:63:30: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 0 and 255 [-Wformat-truncation=]
  snprintf(filepath, 256, "%s/%s", path, filename);
                              ^~
Bump up the buffer to PATH_MAX which is the limit and account for all of
the possible NUL and separators that could lead to exceeding the
allocated buffer sizes.

Fixes: 94f69966fa ("tools/thermal: Introduce tmon, a tool for thermal subsystem")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-17 14:42:15 +02:00
..
accounting
arch x86/speculation: Add RSB VM Exit protections 2022-08-11 13:20:44 +02:00
bootconfig
bpf bpf, x86: Generate trampolines from bpf_tramp_links 2022-08-17 14:41:04 +02:00
build perf build: Fix btf__load_from_kernel_by_id() feature check 2022-06-09 10:30:38 +02:00
cgroup tools/cgroup/slabinfo: update to work with struct slab 2022-02-21 11:34:49 +01:00
counter
debugging
edid
firewire
firmware
gpio
hv
iio Kbuild updates for v5.18 2022-03-31 11:59:03 -07:00
include bpf: Allow storing referenced kptr in map 2022-08-17 14:41:08 +02:00
io_uring
kvm/kvm_stat tools/kvm_stat: fix display of error when multiple processes are found 2022-08-11 13:20:42 +02:00
laptop
leds
lib libbpf: fix an snprintf() overflow check 2022-08-17 14:41:09 +02:00
memory-model tools/memory-model/README: Update klitmus7 compat table 2022-06-06 08:48:56 +02:00
objtool x86/retbleed: Add fine grained Kconfig knobs 2022-07-23 12:56:56 +02:00
pci
pcmcia
perf genelf: Use HAVE_LIBCRYPTO_SUPPORT, not the never defined HAVE_LIBCRYPTO 2022-08-17 14:42:15 +02:00
power tools/power/x86/intel-speed-select: Fix off by one check 2022-08-17 14:41:54 +02:00
rcu
scripts Kbuild updates for v5.18 2022-03-31 11:59:03 -07:00
spi
testing selftests/powerpc: Skip energy_scale_info test on older firmware 2022-08-17 14:42:00 +02:00
thermal/tmon tools/thermal: Fix possible path truncations 2022-08-17 14:42:15 +02:00
time
tracing rtla: Fix double free 2022-08-17 14:41:55 +02:00
usb
virtio tools/virtio: compile with -pthread 2022-03-28 16:52:59 -04:00
vm tools/vm/slabinfo: Handle files in debugfs 2022-08-11 13:20:40 +02:00
wmi
Makefile