delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/04/03/10:27:47

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 3 Apr 2002 17:27:34 +0200
From: Kurt Roeckx <Q AT ping DOT be>
To: cygwin AT cygwin DOT com
Subject: Re: Termcap issue in cygwin
Message-ID: <20020403172734.A272@ping.be>
References: <Pine DOT CYG DOT 4 DOT 44 DOT 0204030354590 DOT 460-100000 AT MPC96>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <Pine.CYG.4.44.0204030354590.460-100000@MPC96>; from chappa@math.washington.edu on Wed, Apr 03, 2002 at 04:38:01AM -0800

On Wed, Apr 03, 2002 at 04:38:01AM -0800, Eduardo Chappa wrote:
>    As far as I understand, the function tgetent, has two parameters, which
> are documented in the manual for termcap(3) and tgetent, the first one is
> of type (char *). According to the manual of the unix system I am using
> the length of this string is supposed to be 1024. I have found that the
> entries for the linux and cygwin terminal are over 1024 characters long,
> which causes this function to corrupt the stack and the program dump core.
> A classical buffer overflow bug. I believe this is an issue with the
> termcap database, which I believe should be shortened to satisfy the 1024
> characters length requirement in (it seems) most (if not all) Unix
> systems.

A small part of the termcap info page:

   With the Unix version of termcap, you must allocate space for the
description yourself and pass the address of the space as the argument
BUFFER.  There is no way you can tell how much space is needed, so the
convention is to allocate a buffer 2048 characters long and assume that
is enough.  (Formerly the convention was to allocate 1024 characters and
assume that was enough.  But one day, for one kind of terminal, that was
not enough.)

It even has some examples.


Kurt


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019