Fix namebuff overwrite leading to wrong log after socket bind warning.
authorSimon Kelley <simon@thekelleys.org.uk>
Fri, 9 Sep 2022 14:56:54 +0000 (15:56 +0100)
committerSimon Kelley <simon@thekelleys.org.uk>
Fri, 9 Sep 2022 14:57:39 +0000 (15:57 +0100)
src/forward.c

index aa9ace0..9d1f005 100644 (file)
@@ -2439,12 +2439,12 @@ static int random_sock(struct server *s)
        return fd;
 
       if (s->interface[0] == 0)
-       (void)prettyprint_addr(&s->source_addr, daemon->namebuff);
+       (void)prettyprint_addr(&s->source_addr, daemon->addrbuff);
       else
-       strcpy(daemon->namebuff, s->interface);
+       safe_strncpy(daemon->addrbuff, s->interface, ADDRSTRLEN);
 
       my_syslog(LOG_ERR, _("failed to bind server socket to %s: %s"),
-               daemon->namebuff, strerror(errno));
+               daemon->addrbuff, strerror(errno));
       close(fd);
     }