[12989] in Athena Bugs
get_phost() is bad in libkrb.a on Solaris
daemon@ATHENA.MIT.EDU (Richard Basch)
Tue Dec 6 13:01:37 1994
Date: Tue, 6 Dec 1994 13:01:24 -0500
To: mbarker@MIT.EDU, miki@MIT.EDU, bugs@MIT.EDU, rel-eng@MIT.EDU
From: "Richard Basch" <basch@MIT.EDU>
It is returning automatically allocated memory, and thus, if you call
other functions such as printf() before copying it (using strcpy), you
will trash the stack and the data returned from get_phost.
Enclosed is the patch. Please apply for release 7.8, as it is very
difficult to get Kerberos applications to work properly without it.
-Richard
*** get_phost.c- Tue Dec 6 12:59:05 1994
--- get_phost.c Tue Dec 6 12:59:18 1994
***************
*** 43,49 ****
{
struct hostent *h;
#ifdef SOLARIS
! char phost[100];
char *p;
strcpy(phost, alias);
if ((h=gethostbyname(&phost[0])) != (struct hostent *)NULL ) {
--- 43,49 ----
{
struct hostent *h;
#ifdef SOLARIS
! static char phost[100];
char *p;
strcpy(phost, alias);
if ((h=gethostbyname(&phost[0])) != (struct hostent *)NULL ) {