[PATCH 5.18 0949/1095] tools/thermal: Fix possible path truncations