[PATCH 5.4 244/389] tools/thermal: Fix possible path truncations