HPCC-10224 Fix CSocket::name returning non terminated strings

CSocket::name, which returns the local server address rather than the
peer address, doesn't seem to be used except a few places in ESP.

The function was memcopying strings without including the null terminator.

Also fixes a couple other issues, like attempting to write to a null
string.

Signed-off-by: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>