chiark / gitweb /
Fix memory management of argument to open_input_file
[inn-innduct.git] / innd / status.c
index f3c2d8d6c91cf3b5c288359a4c845676627e76e3..e2040c112d7298338857a247d90eabbee612d736 100644 (file)
@@ -153,9 +153,14 @@ STATUSsummary(void)
       status = xmalloc(sizeof(STATUS));
       peers++;                                              /* a new peer */
       strlcpy(status->name, TempString, sizeof(status->name));
-      strlcpy(status->ip_addr,
-              sprint_sockaddr((struct sockaddr *)&cp->Address),
-              sizeof(status->ip_addr));
+      if (cp->Address.ss_family == 0) {
+        /* Connections from lc.c do not have an IP address. */
+        memset(&status->ip_addr, 0, sizeof(status->ip_addr));
+      } else {
+        strlcpy(status->ip_addr,
+          sprint_sockaddr((struct sockaddr *)&cp->Address),
+          sizeof(status->ip_addr));
+      }
       status->can_stream = cp->Streaming;
       status->seconds = status->Size = status->DuplicateSize = 0;
       status->Ihave = status->Ihave_Duplicate =