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>
This commit is contained in:
Yoshinobu Inoue 2000-02-07 00:52:49 +00:00
parent bc687a0b51
commit f306e0c85f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57016
3 changed files with 18 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -2298,6 +2298,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;