summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Hannum <mycroft@gnu.org>1996-11-21 20:47:59 +0000
committerCharles Hannum <mycroft@gnu.org>1996-11-21 20:47:59 +0000
commit196777f3d8e32cc243ade0f8e5bf7d653da78ef4 (patch)
tree03cabd589b5eb1c8ebc2bbfa7d74d167e00a25d3
parent6521ac3275cde3f92f59c7b74510966f3e37a5c5 (diff)
downloademacs-196777f3d8e32cc243ade0f8e5bf7d653da78ef4.tar.gz
gethostbyname() may return a pointer to static data, which is
overwritten deep inside krb_realmofhost(). Copy the host name to avoid conflicts.
-rw-r--r--lib-src/pop.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 5657df5a5d0..c4d4c26e5ef 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -1005,6 +1005,7 @@ socket_connection (host, flags)
CREDENTIALS cred;
Key_schedule schedule;
int rem;
+ char *realhost;
#endif /* KRB5 */
#endif /* KERBEROS */
@@ -1175,8 +1176,9 @@ socket_connection (host, flags)
}
#else /* ! KRB5 */
ticket = (KTEXT) malloc (sizeof (KTEXT_ST));
- rem = krb_sendauth (0L, sock, ticket, "pop", hostent->h_name,
- (char *) krb_realmofhost (hostent->h_name),
+ realhost = strdup (hostent->h_name);
+ rem = krb_sendauth (0L, sock, ticket, "pop", realhost,
+ (char *) krb_realmofhost (realhost),
(unsigned long) 0, &msg_data, &cred, schedule,
(struct sockaddr_in *) 0,
(struct sockaddr_in *) 0,