Hello,
telnet from inetutils-2.2 will get stuck if a local environment variable
DISPLAY exists and and has a value longer than 44 bytes (50 -2 -4).
This is due to negotiating command 250 (X DISPLAY LOCATION) and then not
sending it because of the buffer being too small.
The attached patch tries to hack around the problem by increasing the temporary
buffer to some arbitrary larger value and gracefully fail (tested!) if even
that limit is too small.
In case you want to apply the patch as is and you regard this patch as
copyrightable material, I assign the copyright of this patch to the maintaining
organization of this software.
A non-hackish solution would probalby dynamically allocate a temp variable of
proper length.
Kind regards
Jörg
--
Joerg Mayer <[email protected]>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.
--- telnet.c.orig 2022-01-31 15:42:20.000000000 +0100
+++ telnet.c 2022-01-31 15:56:07.000000000 +0100
@@ -995,7 +995,7 @@
return;
if (SB_GET () == TELQUAL_SEND)
{
- unsigned char temp[50], *dp;
+ unsigned char temp[1024], *dp;
int len;
if ((dp = env_getvalue ("DISPLAY")) == NULL)
@@ -1016,6 +1016,7 @@
if (strlen ((char *) dp) >= sizeof (temp) - 4 - 2)
{
printf ("lm_will: not enough room in buffer\n");
+ send_wont (TELOPT_XDISPLOC, 1);
break;
}