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:
parent
bc687a0b51
commit
f306e0c85f
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user