changeset 16603:a12b8815bcf0

gethostbyname() may return a pointer to static data, which is overwritten deep inside krb_realmofhost(). Copy the host name to avoid conflicts.
author Charles Hannum <mycroft@gnu.org>
date Thu, 21 Nov 1996 20:47:59 +0000
parents 510d37fcbaf6
children f3590f61b68d
files lib-src/pop.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/pop.c	Thu Nov 21 07:48:37 1996 +0000
+++ b/lib-src/pop.c	Thu Nov 21 20:47:59 1996 +0000
@@ -1005,6 +1005,7 @@
   CREDENTIALS cred;
   Key_schedule schedule;
   int rem;
+  char *realhost;
 #endif /* KRB5 */
 #endif /* KERBEROS */
 
@@ -1175,8 +1176,9 @@
 	}
 #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,