Fix telnet core dump at invalid service name specified.
Added an error check to avoid it. Approved by: jkh Submitted by: Robert Muir <rmuir@gibralter.net> git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@57016 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
This commit is contained in:
parent
845ce56d7b
commit
92a0e6dadf
|
@ -2475,6 +2475,12 @@ tn(argc, argv)
|
|||
(void) strncpy(_hostname, hostp, sizeof(_hostname) - 1);
|
||||
_hostname[sizeof(_hostname)-1] = '\0';
|
||||
hostname = _hostname;
|
||||
} else if (error != 0) {
|
||||
fprintf(stderr, "%s: %s\n", hostname, gai_strerror(error));
|
||||
if (error == EAI_SYSTEM)
|
||||
fprintf(stderr, "%s: %s\n", hostname, strerror(errno));
|
||||
setuid(getuid());
|
||||
return 0;
|
||||
}
|
||||
if (srcroute != 0) {
|
||||
srp = 0;
|
||||
|
|
Loading…
Reference in New Issue