Re: Bug in telnet from inetutils-2.2: Insufficient buffer space for longish DISPLAY names

Joerg Mayer <[email protected]>
Newsgroups gmane.comp.gnu.inetutils.bugs
Message-ID <[email protected]>
On Sat, Feb 05, 2022 at 05:18:01PM +0100, Erik Auerswald wrote:
[ots of interesting stuff deleted]

I agree with Erik's analysis and conclusions. As any "relevant" telnet implementation
should also implement the NEWENV option there should not even be a loss of functionality
by staying with the original buffer size.

> diff -Naur inetutils-2.2.orig/telnet/telnet.c inetutils-2.2.changed/telnet/telnet.c
> --- inetutils-2.2.orig/telnet/telnet.c	2021-05-25 17:54:19.000000000 +0200
> +++ inetutils-2.2.changed/telnet/telnet.c	2022-02-05 16:31:43.474464119 +0100
> @@ -1011,11 +1011,13 @@
>  	  /* Remote host, and display server must not be corrupted
>  	   * by truncation.  In addition, every character of telnet
>  	   * protocol must remain unsevered.  Check that DP fits in
> -	   * full within TEMP.  Otherwise report buffer error.
> +	   * full within TEMP.  Otherwise report buffer error and
> +	   * turn off the option.
>  	   */
>  	  if (strlen ((char *) dp) >= sizeof (temp) - 4 - 2)
>  	    {
> -	      printf ("lm_will: not enough room in buffer\n");
> +	      printf ("lm_will: not enough room in buffer for DISPLAY\n");
> +	      send_wont (TELOPT_XDISPLOC, 1);
>  	      break;
>  	    }
>  

I prefer Erik's patch over mine.

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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.