delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/02/18/07:15:15

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <000a01c099a4$3336f5a0$0100a8c0@mxstream.nl>
From: "Steven Pemberton" <Steven DOT Pemberton AT cwi DOT nl>
To: <cygwin AT cygwin DOT com>
Subject: tgetent corrupts stack (cured); Small tgetent program crashes gdb
Date: Sun, 18 Feb 2001 13:13:13 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200

------=_NextPart_000_0007_01C099AC.8CBB8CA0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

I had a program where tgetent was corrupting the stack. While trying to
track down the problem, I managed to crash gdb.

This is a report of two problems.

1) 'info tgetent' says that 'the [termcap] emulation ignores the buffer
pointer bp' (the first param of tgetent). However, this isn't true: the
buffer really does get used, and it has to be at least 1038 bytes long (the
'traditional' size for the tgetent buffer is 1024 bytes), otherwise the
stack gets corrupted.

2) with this tiny program, if I debug it with gdb, and stop before the last
line (i=t) and try to look at the contents of 'buf', gdb crashes. With a
value of 1024, or 1536 for the buffer size, gdb doesn't seem to crash.

#include <stdlib.h>
#include <curses.h>

main() {
  char *s; int t, i;
  char buf[2048];
  s= getenv("TERM");
  t= tgetent(buf, s);
  i=t;
}

Steven Pemberton
CWI, Amsterdam
(Not a regular reader of this list, so Cc me if you want a reply)


------=_NextPart_000_0007_01C099AC.8CBB8CA0
Content-Type: text/x-vcard;
	name="Steven Pemberton.vcf"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="Steven Pemberton.vcf"

BEGIN:VCARD
VERSION:2.1
N:Pemberton;Steven
FN:Steven Pemberton
ORG:CWI
TEL;WORK;VOICE:+31-20-592 4138
TEL;HOME;VOICE:+31-20-638 5568
TEL;CELL;VOICE:+31-624 671 668
TEL;WORK;FAX:+31-20-592 4199
ADR;WORK:;;Kruislaan 413;1098 SJ Amsterdam;;;The Netherlands
LABEL;WORK;ENCODING=3DQUOTED-PRINTABLE:Kruislaan 413=3D0D=3D0A1098 SJ =
Amsterdam=3D0D=3D0AThe Netherlands
X-WAB-GENDER:2
URL;HOME:http://www.cwi.nl/~steven/
EMAIL;PREF;INTERNET:steven DOT pemberton AT cwi DOT nl
REV:20010218T121313Z
END:VCARD


------=_NextPart_000_0007_01C099AC.8CBB8CA0
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
------=_NextPart_000_0007_01C099AC.8CBB8CA0--

- Raw text -


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