Not only setenv(), also putenv() allocates memory on my system (glibc 2.16.0). Just fail with a clear message if XDG_RUNTIME_DIR is not set. https://bugs.freedesktop.org/show_bug.cgi?id=52618
These would either overflow the struct sockaddr_un, or be truncated and leave a non-null-terminated string.