mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
3 changed files with 18 additions and 0 deletions
|
|
@ -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…
Reference in a new issue