diff -u openssh-2.9p2/channels.c~ openssh-2.9p2/channels.c
--- openssh-2.9p2/channels.c~	Mon Jul 23 13:50:54 2001
+++ openssh-2.9p2/channels.c	Mon Jul 23 13:50:54 2001
@@ -2159,7 +2159,7 @@
 	char strport[NI_MAXSERV];
 	int gaierr, n, num_socks = 0, socks[NUM_SOCKS];
 	char display[512];
-	char hostname[MAXHOSTNAMELEN];
+	char hostname[401];	/* we only use the first 400 bytes anyway*/
 
 	for (display_number = x11_display_offset;
 	     display_number < MAX_DISPLAYS;
@@ -2232,7 +2232,10 @@
 
 	/* Set up a suitable value for the DISPLAY variable. */
 	if (gethostname(hostname, sizeof(hostname)) < 0)
-		fatal("gethostname: %.100s", strerror(errno));
+		if (errno == ENAMETOOLONG)
+			hostname[sizeof(hostname) - 1] = 0;
+		else
+			fatal("gethostname: %.100s", strerror(errno));
 
 #ifdef IPADDR_IN_DISPLAY
 	/*
