From 714d534bd05b4c149a8d5d8423f010ba5d05a87f Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Thu, 16 Dec 1999 11:51:06 +0000 Subject: [PATCH] (*): handle ai_canonname not being set git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7611 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/telnet/telnet/commands.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/appl/telnet/telnet/commands.c b/appl/telnet/telnet/commands.c index b328b0624..01da96b4f 100644 --- a/appl/telnet/telnet/commands.c +++ b/appl/telnet/telnet/commands.c @@ -1589,7 +1589,8 @@ env_init(void) error = getaddrinfo (hbuf, NULL, &hints, &ai); if (error == 0) { - strlcpy (hbuf, ai->ai_canonname, 256); + if (ai->ai_canonname != NULL) + strlcpy (hbuf, ai->ai_canonname, 256); freeaddrinfo (ai); } } @@ -2175,7 +2176,10 @@ tn(int argc, char **argv) setuid (getuid ()); return 0; } - strlcpy (_hostname, ai->ai_canonname, sizeof(_hostname)); + if (ai->ai_canonname != NULL) + strlcpy (_hostname, ai->ai_canonname, sizeof(_hostname)); + else + strlcpy (_hostname, hostp, sizeof(_hostname)); hostname = _hostname; for (a = ai; a != NULL && connected == 0; a = a->ai_next) {