diff options
author | Ken Raeburn <raeburn@mit.edu> | 2001-09-07 14:58:06 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2001-09-07 14:58:06 +0000 |
commit | 584a429a9349a9fb6f1140d28e343c403e37b6da (patch) | |
tree | b6ac1167b688caee5a04a3a219053e4d4fa94ac0 | |
parent | 2b11d86f48fb634fe413a354dde964b90f9fef20 (diff) | |
download | krb5-584a429a9349a9fb6f1140d28e343c403e37b6da.zip krb5-584a429a9349a9fb6f1140d28e343c403e37b6da.tar.gz krb5-584a429a9349a9fb6f1140d28e343c403e37b6da.tar.bz2 |
* commands.c (tn): Don't crash printing null hostname in case where supplied
destination is a numeric address that doesn't map to a hostname.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13739 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/appl/telnet/telnet/ChangeLog | 6 | ||||
-rw-r--r-- | src/appl/telnet/telnet/commands.c | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/appl/telnet/telnet/ChangeLog b/src/appl/telnet/telnet/ChangeLog index b10f245..1781738 100644 --- a/src/appl/telnet/telnet/ChangeLog +++ b/src/appl/telnet/telnet/ChangeLog @@ -1,3 +1,9 @@ +2001-09-07 Ken Raeburn <raeburn@mit.edu> + + * commands.c (tn): Don't crash printing null hostname in case + where supplied destination is a numeric address that doesn't map + to a hostname. + 2001-09-01 Ken Raeburn <raeburn@mit.edu> * Makefile.in (SRCS): Use $(srcdir). diff --git a/src/appl/telnet/telnet/commands.c b/src/appl/telnet/telnet/commands.c index ef4d3ee..855bf24 100644 --- a/src/appl/telnet/telnet/commands.c +++ b/src/appl/telnet/telnet/commands.c @@ -2529,8 +2529,9 @@ tn(argc, argv) error = getaddrinfo (hostp, portp, &hints, &addrs); if (error == 0) { if (getnameinfo (addrs->ai_addr, addrs->ai_addrlen, - _hostname, sizeof(_hostname), 0, 0, NI_NAMEREQD) == 0) - hostname = _hostname; + _hostname, sizeof(_hostname), 0, 0, NI_NAMEREQD) != 0) + strncpy(_hostname, hostp, sizeof (_hostname)); + hostname = _hostname; } else { not_numeric: hints.ai_flags = AI_CANONNAME; |