There was a bug in realhostname_sa() in lib/libutil and
sometime daemon using it dies, such as telnetd.

I think following patch will fix it, but now checking make
world before actually committing it.

If anyone experienced same problem, please try following
patch.
Sorry for your troubles.


Yoshinobu Inoue


Index: realhostname.c
===================================================================
RCS file: /home/ncvs/src/lib/libutil/realhostname.c,v
retrieving revision 1.4
diff -u -r1.4 realhostname.c
--- realhostname.c      2000/01/25 14:51:57     1.4
+++ realhostname.c      2000/01/27 11:37:08
@@ -122,8 +122,10 @@
                                port = ((struct sockinet *)addr)->si_port;
                                ((struct sockinet *)addr)->si_port = 0;
                                if (!memcmp(sa, addr, sa->sa_len)) {
-                                       strncpy(host, res->ai_canonname,
-                                               hsize);
+                                       if (res->ai_canonname != 0)
+                                               strncpy(host,
+                                                       res->ai_canonname,
+                                                       hsize);
                                        result = HOSTNAME_FOUND;
                                        ((struct sockinet *)addr)->si_port =
                                                port;
@@ -146,8 +148,10 @@
                                if (IN6_IS_ADDR_V4MAPPED(in6) &&
                                    !memcmp(&in6->s6_addr[12], in,
                                            sizeof(*in))) {
-                                       strncpy(host, res->ai_canonname,
-                                               hsize);
+                                       if (res->ai_canonname != 0)
+                                               strncpy(host,
+                                                       res->ai_canonname,
+                                                       hsize);
                                        result = HOSTNAME_FOUND;
                                        break;
                                }


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to