decode: avoid using a static buffer in th_get_pathname()