peer: Properly set thread id string

Remove reallocation of the thread id buffer just to remove
the null termination. Set thread id string by memcpy()'ing
until the null termination the temporary buffer holding
the thread id.