Fix for coverity (fix potential buffer overflow in cleanup_tmp_dir)