Date: Thu, 27 Jan 2000 20:50:08 +0900 From: Yoshinobu Inoue <shin@nd.net.fujitsu.co.jp> To: freebsd-current@freebsd.org Subject: realhostname_sa bug Message-ID: <20000127205008V.shin@nd.net.fujitsu.co.jp>
next in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000127205008V.shin>