support ttype/environ/new-environ/mssp parsing (using alloca; fixme?)
diff --git a/telnet-client.c b/telnet-client.c
index f380cd3..aa25e4a 100644
--- a/telnet-client.c
+++ b/telnet-client.c
@@ -34,8 +34,9 @@
 
 static const telnet_telopt_t telopts[] = {
 	{ TELNET_TELOPT_ECHO,		TELNET_WONT, TELNET_DO   },
-	{ TELNET_TELOPT_COMPRESS2,	TELNET_WONT, TELNET_DO   },
 	{ TELNET_TELOPT_TTYPE,		TELNET_WILL, TELNET_DONT },
+	{ TELNET_TELOPT_COMPRESS2,	TELNET_WONT, TELNET_DO   },
+	{ TELNET_TELOPT_MSSP,		TELNET_WONT, TELNET_DO   },
 	{ -1, 0, 0 }
 };
 
@@ -125,7 +126,7 @@
 			buffer[0] = 0; /* IS code for RFC 1091 */
 			snprintf(buffer + 1, sizeof(buffer) - 1, "%s", getenv("TERM"));
 			telnet_subnegotiation(telnet, TELNET_TELOPT_TTYPE, buffer,
-					1 + strlen(buffer + 1));
+					strlen(getenv("TERM")) + 1);
 		}
 		break;
 	/* error */