Check if the pointer is NULL
@@ -1439,6 +1439,10 @@ static void sockaddr_to_string(char *buf, size_t len, const union usa *usa)
{
buf[0] = '\0';
+ if (!usa) {
+ return NULL;
+ }
+
if (usa->sa.sa_family == AF_INET) {
getnameinfo(
&usa->sa, sizeof(usa->sin), buf, len, NULL, 0, NI_NUMERICHOST);